Example of a JScript ; _, I, J. @" W: Z1 T& I6 ^
var vbOKCancel = 1; + f0 M4 u6 N% t( u$ W
var vbCancel = 2; 2 y n; n' v/ ~7 f6 Q' C' Q3 T
var vbInformation = 64; 9 v' x) c9 X/ L8 \$ ]
var Finished=false; : L) m5 ]) G6 l( z9 s1 s* |7 b; p
* q5 M0 J/ Y ^& Q- N' d5 lvar WSHShell = new ActiveXObject("WScript.Shell"); 8 w, ~/ H! g2 i) r# }$ Y/ r
; l+ x; r+ K; e! k0 N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 L6 R4 O! ?7 M% T5 |3 ?. X* ^6 k " q' ]0 I% ]# z* n
simple.SetLicenseType("Runtime"); 7 v* D8 ?& y) F/ v+ a
1 a' z: Y9 F5 }' K4 W3 u, S
try 3 E9 e& x" ^5 z+ w
{
a/ K4 K/ l* J. }5 |8 Q: m // Enter the path to a model file! - f7 J( k# \% S: v! r
simple.LoadModel("C:\\Models\\Test.spp"); 3 m! T) y: C7 h3 E* ^" e& f
} ; g0 J; m1 y$ g1 p8 U
catch (e)
4 m& k# b: k% G{ * x5 _" n4 G" y2 d1 Q& \7 G! F
WScript.Echo("Could not load Model!"); 4 O. ^. I. Q' R% t1 A- O
WScript.Quit(); $ n$ I! k3 ^& g( ~/ y5 c* O# V+ d9 u
} 8 i; ` g4 R b7 r2 `
6 K V8 L: m. D2 Ztry
* D+ F0 I. s5 y/ d1 v{ , b" u" `& X3 h) ]: h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 }1 y7 T! @7 F! a r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' T+ C+ @, L, @ t `5 y& E
if (r == vbCancel)
, X' _9 x) [: L! }3 h {
% n% n% Z3 w4 q# _ simple.CloseModel(); 1 \" g2 ]8 u! C4 }
WScript.Quit();
2 Y h( E2 j8 `6 e$ e6 J } 3 g t! Q8 Z& l3 ?4 s8 K
}
' n- x' X( {4 s* Q, n 6 H% E) q9 Y, O3 a
simple.StartSimulation(".Models.Frame.EventController"); & y+ w) m4 }* W; x
p" g' |/ ^5 f
if (simple.IsSimulationRunning())
+ O; Z& u& X! a6 p4 f8 V) M WScript.Echo("Simulation is running!"); ; w7 j5 w7 \6 ^# S4 e
* h+ v2 K7 D2 |& Y" K
// Wait until simulation is finished
& p! z- A& R& twhile (!Finished) WScript.Sleep(2000);
( p, Z% k* W$ \6 ] $ Y/ k& @; V, _/ G9 G* L
simple.CloseModel();
+ ]. Q6 F4 Q1 Z; s* J' x( j5 hsimple.Quit(); " K5 `5 p* W( h# |
WScript.Quit();
3 d& L% \; f: w; T6 ~& ^1 S
1 Q/ q: |5 m, G% Q* q & ~! o/ H% y7 X, n$ V4 j# k9 @
function RemoteControl_SimulationFinished() 1 u- N3 i; @& {4 S( |
{
6 ^8 a* Z! Y/ x* @* g- V' } WScript.Echo("Simulation Finished!"); |