Example of a JScript
; S( q' I& U; d9 j. Gvar vbOKCancel = 1;
1 o6 \0 }% Y) T2 K! ~var vbCancel = 2; 4 @- N# C' P' H" v2 k( o
var vbInformation = 64; ! F) O: m6 H: B* h7 R
var Finished=false; " B/ h) M0 V6 m! Q
, y: x5 B! l' J' W' Z8 h( R% B' s
var WSHShell = new ActiveXObject("WScript.Shell");
+ {9 Y1 Z4 u- o- }- s & _! p9 W8 ^/ x- F5 e7 c
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # P U+ O% w- T; b: I2 ~
4 D) k/ j* L% w; y) }, {
simple.SetLicenseType("Runtime"); & J/ ~1 }. [! m: \
' U8 u2 g( B) ]4 v) J# h5 P
try 0 M0 ^1 o: X: w4 ^
{
$ N$ [) K- D R$ n" l, G // Enter the path to a model file!
( X- C' g' ^+ Y; b simple.LoadModel("C:\\Models\\Test.spp"); 5 s- C F) L) p0 f
} ; o$ F/ v% \7 p' K7 l& A
catch (e)
8 F2 w/ R. b6 i! _{
8 V' k" ]4 L# n. s9 y0 A6 _$ C6 p WScript.Echo("Could not load Model!"); 2 D, j+ t7 e( k
WScript.Quit(); 1 f0 b; `$ t I5 V: i w: B/ H
}
9 t. H7 B, w, b; V / N: p6 [8 b- s$ P2 Y
try 4 ?9 ^. j! x6 h' R/ }
{
' s0 Z9 z* d+ v! C( f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) U. I) l: ]# h) D g' h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # M6 F6 \+ J6 Y& b# Q8 T) \" H
if (r == vbCancel)
* |5 f4 j7 c4 \3 G' m { y# W' H/ Y, }% L
simple.CloseModel();
8 ]9 t( Z F: p+ O3 n WScript.Quit(); , h7 B" g# H+ c8 V
} * a& ?/ ?' A8 D6 Z$ o/ e
} 8 `/ w9 ?" d# h: t# X% T6 J
: Y2 X, t- V$ c) F( O! r
simple.StartSimulation(".Models.Frame.EventController");
7 a* s. ?( k- v# W7 _+ U
3 [7 S: j3 x9 _6 y) Q0 vif (simple.IsSimulationRunning())
# Y( t) ~" l* S" n. A WScript.Echo("Simulation is running!"); ! j/ F3 t) @; ?
i9 H* N) e! c( C
// Wait until simulation is finished " m. \9 b a7 K5 h% B
while (!Finished) WScript.Sleep(2000); 0 V# N6 C1 |' \' m
4 E7 j2 \9 U8 I/ Jsimple.CloseModel();
0 g5 I8 x+ r4 O9 X. Osimple.Quit(); 5 c- J" p1 x. O$ C
WScript.Quit(); u% F* W2 `& _' l9 _0 F
% b/ |; d; q+ Z. a
# k1 |7 ?. E* c! U9 mfunction RemoteControl_SimulationFinished()
! x5 R; b+ o: q{ $ J' U# P( F4 ]/ O
WScript.Echo("Simulation Finished!"); |