Example of a JScript
3 Z& ^2 Y+ A; `& L5 qvar vbOKCancel = 1; : W, Q4 N1 a0 l) _; p; o+ p3 M
var vbCancel = 2;
5 @" ~# ]/ p2 F; P8 t* w+ gvar vbInformation = 64;
* ^& I* L/ Y2 |" g7 @' Tvar Finished=false;
+ o6 Z2 f: ` s7 C+ N : u' B# M1 ^* b0 m' d) j3 Y
var WSHShell = new ActiveXObject("WScript.Shell"); ( v U# Y) Y4 M( f: R5 _
- _/ a6 Y0 a& x: P4 Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
C/ L N3 w8 x9 t
9 K5 N' b" \* o9 x8 Ksimple.SetLicenseType("Runtime");
4 M5 ?7 F3 ^) ^7 ^0 @ " e5 j; D) O6 t3 a$ a
try
+ H$ H" b# X% Q$ n5 D{
+ j: X, |7 d( @ // Enter the path to a model file!
" C3 [0 C/ O' z simple.LoadModel("C:\\Models\\Test.spp");
+ p& J6 j6 Y/ b+ V+ Y1 g% k; r} 8 R: W# E! J! E9 Z7 J. _ i% Z8 q
catch (e) 2 R, T3 x; X+ T# s
{
5 S: a; o% m9 K; ~6 | WScript.Echo("Could not load Model!");
0 k* ^, v! h" f' o+ D- _ WScript.Quit(); * @# S: _1 s1 G8 ~6 T
}
, g2 q. H$ l2 ] - I7 R2 f/ x' _/ U7 u7 }
try
* d0 U3 g# ?4 t. l4 `{
' V; ^% {( Q& |7 [- Z: k simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 g! v1 d F5 M" X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! T0 N. z6 Y* i
if (r == vbCancel)
2 U4 w$ N4 r% k+ P! i# W { , }- J1 L, x) A/ s6 Q5 r
simple.CloseModel();
5 Y' }5 w3 T3 s. r# D1 { WScript.Quit();
. n& g8 e9 x" g9 S; E( a } % C9 g$ z) T- v) `& O
}
# A# b9 M% U1 }, ? # s; N' ~' [7 d% q
simple.StartSimulation(".Models.Frame.EventController"); 9 y3 \& l! U: f, l( M
4 N2 z) I. T) D! Bif (simple.IsSimulationRunning()) 0 j/ F3 x) \+ f3 X- {- F9 ~% C; b# p
WScript.Echo("Simulation is running!"); 1 d; _* c$ R1 t: }, J
# p7 m" L# ^! c6 V$ a( I7 H// Wait until simulation is finished # I$ y6 m! q8 z6 P2 @
while (!Finished) WScript.Sleep(2000);
8 B* z! ]# p6 [8 S2 n% R$ E1 Q
1 r3 d) ]$ Y. {1 jsimple.CloseModel();
( i3 k! T9 ?; C0 tsimple.Quit(); + e/ u q. b0 `
WScript.Quit();
o: m7 x1 p4 s6 U! O+ l ) J3 {1 i, V; k7 x$ j6 v
- q# W% b( t. n) ~- @3 qfunction RemoteControl_SimulationFinished() & h' [- E" \4 |( s) Z2 y
{ / o& z% r: Z* T- m( s# j
WScript.Echo("Simulation Finished!"); |