Example of a JScript
! |; D+ c0 {0 m0 v& ?var vbOKCancel = 1; * ?/ d3 |% O" \) r; s( ^, I3 r, J" j& ~
var vbCancel = 2;
A; _, a, ~( N! B2 tvar vbInformation = 64; & @6 ?% o8 m3 ~( W
var Finished=false;
4 L% T2 e6 }) I& a# v 4 G8 |- i7 v8 ~4 \
var WSHShell = new ActiveXObject("WScript.Shell");
+ D' y/ ~+ x0 C8 @6 i
( G! O$ m, Z, \4 H; b# Xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 @* Z+ Z! r/ f 7 B3 U: P' [1 c! N& X: r
simple.SetLicenseType("Runtime");
( r; t6 G! \* H' B* @2 E 5 ~2 g( p# @ a8 d- @0 C
try
. w9 q7 b, Y2 K4 Y{ ) T5 L2 z% h; J3 ^8 L! ?
// Enter the path to a model file!
$ R/ i( Q1 A2 |( ~7 D4 _' U) N, D simple.LoadModel("C:\\Models\\Test.spp");
0 @2 A; u4 ]- D/ X+ {$ n}
W* y' p9 A" p6 ~) A- |catch (e) 7 o6 @1 q: F6 r! P1 D
{ + Z8 q' ?# E, M! ~* b
WScript.Echo("Could not load Model!"); % q0 A# m, n' g4 {
WScript.Quit();
* ?, K8 F, K" a. W}
! w: v# |6 {: ^9 s: |( `
. ^1 k- [* u7 O! Ctry
% l. a& j3 S4 T8 y A{ 7 ^" Q* @7 H( ?: X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 F, g6 W1 P1 y3 w5 a' Q+ w5 q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " ~; h0 S$ Q3 \- { j) \+ E% V- @
if (r == vbCancel)
+ ?3 Z: j/ z- N9 S' q { - r5 G; w T# h o
simple.CloseModel();
s+ T! P" {8 }$ E% r WScript.Quit(); 7 T# v$ U) v$ S0 M4 h. |, B
}
4 D( V7 |* S* L1 r' @: C% b}
$ x8 [6 \0 X0 I% E/ A$ _3 q' ~
a( n1 D9 _! ]simple.StartSimulation(".Models.Frame.EventController");
, n5 t2 Q: S* C * g9 D" ?9 X7 m
if (simple.IsSimulationRunning()) 8 v+ j) e4 s& U# ?: z6 c, {
WScript.Echo("Simulation is running!");
?, t. J! T/ g) U/ I8 \" b& y
2 v; m7 C, \9 Q2 t: E1 i// Wait until simulation is finished 7 S* F. Q) D: v) j/ B1 q! v
while (!Finished) WScript.Sleep(2000); 9 {) b) e# m( B! f( R; a9 B
7 A3 e% g7 H8 W0 k
simple.CloseModel(); 4 K5 p: c$ B! k! K
simple.Quit(); $ F, i$ | q; M- g8 z
WScript.Quit();
+ D6 p* O- j7 p h! Y) w( {& Q( Z 8 i2 z1 c+ n$ G1 t% D0 [
& ?, m0 P \7 ~7 @. d- z
function RemoteControl_SimulationFinished() & N8 L# c. _: e, l, x# x$ u
{ . S) {: a" H4 w5 o* V! K
WScript.Echo("Simulation Finished!"); |