Example of a JScript
4 |4 L( u5 T9 g7 A3 rvar vbOKCancel = 1; # |# ]" X v/ [& U) X& k
var vbCancel = 2; ! {7 t* D+ K8 T2 e
var vbInformation = 64; ( z0 R# a! ^9 V5 i z
var Finished=false;
! K- o7 K+ V, R1 _8 s
5 F- \: q% l/ b0 O7 ]- a, Yvar WSHShell = new ActiveXObject("WScript.Shell"); 9 Y" H0 _ \+ Z L/ B
9 s3 Y" j1 N, \( G; E5 d& j }" _7 ]
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- ^( {9 d; o' t4 H5 q
) Z+ {1 J! W+ q3 nsimple.SetLicenseType("Runtime"); 3 t# U: B* T* I: k! u
& H; O( u$ f* B3 E5 P
try ! O6 K+ u: y1 s5 k
{ - _; [' |, a$ J6 W
// Enter the path to a model file! % D, ?) z$ ]0 w& P& s) ~
simple.LoadModel("C:\\Models\\Test.spp");
3 l: B, H7 S. f1 m/ M1 S' g* v} 6 q0 E4 j2 j* J% i6 V
catch (e) & Z1 F) N( ^1 e g
{ 3 C M/ q! j. ~, R( k$ y
WScript.Echo("Could not load Model!"); . ~, x' u5 q$ [$ `
WScript.Quit();
4 ^4 r K; z: ^}
) F- i2 M, H8 j! e0 r3 u
5 P- ]) a) T9 O! Dtry
, | O% w' W. c9 k# p% t{
: g& Q6 U# o$ Y# C, g2 C# s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ `* _' J1 }, Q, l- ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 F( }( U/ w! @3 K8 {) i if (r == vbCancel)
0 ~" W; v, V( q: [. b' w {
* y+ `* ]* X$ }- ^ simple.CloseModel();
" q8 v6 C0 q1 P, }# t WScript.Quit(); 3 G/ A0 Z2 h+ \- y0 F! q; @
} 2 j) E4 {( f# X
} $ j/ O. K5 | d4 g1 B
* {; a# o$ K5 ]2 J3 G0 E' h
simple.StartSimulation(".Models.Frame.EventController");
' L3 q. J+ C/ r % d( `7 i- X9 f, U! l$ S
if (simple.IsSimulationRunning())
2 i, w9 I/ |- v: ]; C( v8 t& k$ I WScript.Echo("Simulation is running!");
' L8 E; |- ?; r. ?
9 Y1 i3 n v2 @ U7 Y: ^8 J1 i// Wait until simulation is finished 8 _. @+ ~4 s+ x. b* x1 H+ W
while (!Finished) WScript.Sleep(2000);
! N/ `+ l" ]" R' O ' u! D' J5 b& S5 R" O
simple.CloseModel(); 4 k U) }* m$ V
simple.Quit(); 1 D5 m3 p2 }# w) j- }4 Z
WScript.Quit();
/ b2 N( M- U7 ~! I; x ( l7 u/ p& C! A6 ~ B& {+ F4 [
5 T W2 r" n3 W3 U" A, n1 ^3 W' qfunction RemoteControl_SimulationFinished() ) V8 W9 t# u" q' D: I
{ . [# O0 _( D5 l$ D: } z" V9 d
WScript.Echo("Simulation Finished!"); |