Example of a JScript
. X( t0 S% @. G- r7 j: Tvar vbOKCancel = 1; - V% L" _/ m* Q6 ?8 a
var vbCancel = 2; ( i$ K2 O* M8 {+ |# k7 e5 e3 h2 b
var vbInformation = 64; + C8 w0 D. E" V( r( t7 I4 u
var Finished=false; & | a. Q; @5 U" G5 [
7 j# \# }+ E9 A6 P1 g/ Cvar WSHShell = new ActiveXObject("WScript.Shell"); 9 P' z* X" I0 H2 B! p* U ~
" g% x+ X( }" Xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( ?/ v, s& K6 }. X: w9 m
5 l! |; o1 L$ {% h
simple.SetLicenseType("Runtime");
x& u: C5 M/ C1 v" I, I" N
9 L! x! B7 |' u! o0 m: X$ R* qtry
5 ~* _% g B' e; i4 k7 s{ + o7 E% H. g$ T: E* I
// Enter the path to a model file! * t/ r1 p) F- |" \
simple.LoadModel("C:\\Models\\Test.spp"); & v5 w) `# w! ~* O' ]
} : T; L9 B* F. f
catch (e)
1 `* i' U& z5 X; z* B/ {{ 7 Y+ E- j8 g; E$ ~, r! T
WScript.Echo("Could not load Model!"); % ~: k$ C6 k1 V$ S
WScript.Quit(); 5 `1 }+ g& O/ n% r8 b1 K! y. D
} ; l% b2 e7 K. g
" [1 \& U& L, h7 i: [0 G1 r8 _try " I) d- L! F9 r& T$ _
{ 2 V0 x) F9 I2 H" @ b/ c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , z2 ]) x5 }9 e9 `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " S0 \* n' v$ u# N
if (r == vbCancel) - m6 J2 i- y. c2 s
{
2 c" V T7 I# t* |4 \; {$ H- a simple.CloseModel();
7 S! o: s* w, e WScript.Quit(); 0 O/ o6 s1 E, _' l
} ; }9 h ~6 p& k2 L' R
}
$ Q& y4 r9 J- B" b9 c' d 3 s& w5 S% M8 D5 |, q
simple.StartSimulation(".Models.Frame.EventController"); 1 w7 g2 E9 Y% o+ _: t0 J
3 \; N: z! k+ F; V' n
if (simple.IsSimulationRunning()) - z' ^$ G- C+ |
WScript.Echo("Simulation is running!");
d) q; h5 w$ ] $ K; h6 R" S# z
// Wait until simulation is finished 0 ]3 Q- x& f9 r
while (!Finished) WScript.Sleep(2000); ! a4 g$ G/ d6 L, L# \+ |8 w
' }0 G/ l+ e; msimple.CloseModel();
* {4 L7 v4 B n8 Csimple.Quit();
) `2 l" W; D# G- o; E! j/ ]WScript.Quit(); . `! ~; b5 c' B( I
( g- c5 N7 i" j, I& V) E- \" q
7 Q' |' X8 b7 R0 g$ i" X
function RemoteControl_SimulationFinished() 1 c3 V5 p; R- L, G$ M
{
; `4 P' j+ H3 c5 H/ P WScript.Echo("Simulation Finished!"); |