Example of a JScript
+ Y: x* n2 ]1 }- [" d) ], G5 Nvar vbOKCancel = 1; ! v: E( \! d& m5 j
var vbCancel = 2; " M6 [' p7 O8 J& j
var vbInformation = 64; 7 ~' F! ~8 e+ K1 V
var Finished=false;
! V% P; }( D: j- @" t' w( s
5 z+ D; v& j$ ~: _' k5 t/ ^( Zvar WSHShell = new ActiveXObject("WScript.Shell"); V! z5 O' ] }& x6 U' E
- K# N4 E8 {4 R1 h0 J8 Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! o$ K8 }$ m* M
. o5 \; Y. t3 _% z$ v
simple.SetLicenseType("Runtime"); 8 C' W- \+ f( x9 |, ^3 m0 C& E
) l" h$ U X0 A
try
& z* t* L% \* S! w1 ~{ & z: V% u0 }; }# F5 V# z$ z9 g6 K
// Enter the path to a model file! 9 w. F: Z2 H1 C% z0 U
simple.LoadModel("C:\\Models\\Test.spp"); ) ?5 Q. U- M0 m" z/ q
} & O$ N3 b g% H3 z5 o
catch (e)
& W B& X: N# }{ ( b1 B4 Y& p5 S* o$ K4 `3 W5 d
WScript.Echo("Could not load Model!");
( B5 J1 p+ Z3 i- P WScript.Quit(); 6 C P) r; L7 R% u: _
} # Y `# ~0 J4 K$ O. h% A
" L1 G* m* j; C2 S$ Rtry
0 v( C3 X; X; e$ p& X{ . D: F0 A$ U: g# d9 p) @7 A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " b- I. b1 p9 D% N* \4 P1 h0 J
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 I- `6 Y, m, Q4 f8 G if (r == vbCancel)
+ |# w, q4 p. e3 v0 V { ' U& q r* B [3 [4 R
simple.CloseModel(); 1 K8 W6 Q- W8 @) a) m0 o
WScript.Quit(); ( l0 @1 K* K% N
} + r5 U2 W# F, \7 V. a7 c
} - E% T& _ P+ [& p4 N
% j* r4 b6 H2 |simple.StartSimulation(".Models.Frame.EventController");
! O+ D) J0 [* J. b! u+ e9 _+ v' F3 f % {* C$ A5 h! M8 s; x$ K0 W
if (simple.IsSimulationRunning())
/ I. D, `: z1 ^. ] WScript.Echo("Simulation is running!"); k0 e4 ?: l2 b- l3 F2 {% y
/ ^ u0 T( B7 G5 F. R1 g# n5 `0 s
// Wait until simulation is finished
* b+ ]" H- _$ @6 W+ T. D3 \while (!Finished) WScript.Sleep(2000); ( |/ U8 P9 J4 _1 W, i% M/ v
: {# w2 G& b: {, |: a
simple.CloseModel(); : L3 R1 ~* F5 T' N8 J( B5 w8 s
simple.Quit(); ' _ B6 R- l [
WScript.Quit();
; ^& t4 {- N( @& c6 Q5 x
b) S/ q8 [: k8 K/ @5 y: R" X1 ]0 R . `) t0 [& q" _& I: t
function RemoteControl_SimulationFinished() , ?3 W7 q& ~- O
{ 6 X& _5 z* y3 v' b9 H/ ~
WScript.Echo("Simulation Finished!"); |