Example of a JScript
* p c+ |& ~0 ivar vbOKCancel = 1; ) J: V) z$ l' G U( u3 h/ X8 F
var vbCancel = 2; ' s1 S% k* m- R# P% b
var vbInformation = 64; & m% N, A1 T3 O; \& |3 l- R0 g
var Finished=false; 1 @( e2 c& x7 f" v9 ]! k
x M4 z. m% U! e+ z
var WSHShell = new ActiveXObject("WScript.Shell");
0 c! r) ^1 ^2 S" _) u: I ) Q5 F- ~6 ?5 F; n* h3 m/ Q% v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / q" ^- n' ]' S; r$ L
- _; S! V6 c, s
simple.SetLicenseType("Runtime");
) K8 D$ s" Y% `/ \/ p/ O% ~0 t
% P3 _5 j8 D. l- A9 a2 B# o/ P# \try
/ s h5 P, _# F( A) ~) Y{
7 t" ]9 _% n* E6 H4 F0 o5 Y" H // Enter the path to a model file!
) a# R# n, P2 M( y# x simple.LoadModel("C:\\Models\\Test.spp"); A6 l% i% t; s- o# K* t2 m$ `
} / T9 O: H6 h2 D: P0 X
catch (e) + F, M, Y' N2 _' I
{ ( O, u5 l2 p% { \7 Q v: _
WScript.Echo("Could not load Model!");
4 T* l& ]7 y3 E2 q* E: Q, g- u WScript.Quit(); 0 q" X6 c# y& q# K- o
}
7 l/ L9 d" q# H" S/ d6 J
0 t9 l2 b3 B# i6 f1 G9 k( Otry
9 t8 e9 q6 j( r( m6 x1 w3 F{
! ^/ d7 u/ x7 ~* c$ F* i simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 `9 \, c9 R- E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" x' h7 J# f# |* P1 X/ l: p if (r == vbCancel) ' {" e& I2 {0 |+ y
{
- b* k$ J7 p1 Y) \1 s& Z simple.CloseModel(); # F j& k: J& P! K1 N+ s5 i4 [# w$ O9 o
WScript.Quit(); 8 d% x3 `; b& m* ~2 P9 i
}
* l V6 Z& Y h) n} * @; h6 b1 V# j) n/ O
9 _/ m" D: a- r* p( R0 q
simple.StartSimulation(".Models.Frame.EventController"); ) k. f1 R+ A2 ?/ ]; q
1 K9 _: P6 P4 A/ u1 B7 S3 \) s
if (simple.IsSimulationRunning()) 3 W' z* |1 Z' y+ m) W
WScript.Echo("Simulation is running!");
) ?8 @# M6 V, |/ F( I3 | 0 Z: j3 s! j& \5 P; Y" }* ]
// Wait until simulation is finished
, o) a+ z# s4 twhile (!Finished) WScript.Sleep(2000);
/ F+ |, _; K( N% t " I% T8 N5 k0 A+ k7 R' v
simple.CloseModel(); ; c/ K, U* l/ X" }* f% i
simple.Quit(); ( t# _# V$ Z6 G& T2 T
WScript.Quit(); ! Q& \1 r8 F' Z7 G% E* r8 t
: s# ]5 f' B8 @! Q/ r
* O, U% I- [+ G# ?function RemoteControl_SimulationFinished()
1 n# B$ k' Y: K: l0 B{ 7 U0 H4 o2 @6 n4 f. o( |4 u4 k
WScript.Echo("Simulation Finished!"); |