Example of a JScript
4 N U: ?+ P/ |" G" Q! u% d1 Ivar vbOKCancel = 1; & q5 w* V$ _' S' q# R9 j
var vbCancel = 2;
5 b! g& I9 z% j# e0 |- R9 nvar vbInformation = 64;
0 C1 t# X! j' evar Finished=false; 9 q' }* U+ U- ?
( B: d% b: E6 I2 ^0 q. T' tvar WSHShell = new ActiveXObject("WScript.Shell"); $ @- p: M& S7 G' Y& a+ n1 m
1 k, x0 K, Y4 x1 l% {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / B3 w' E1 T( U3 E( B, z$ y+ d
$ q) T: D$ H: F% R5 tsimple.SetLicenseType("Runtime");
! }7 E* x3 f) I# F4 `* S - i+ `8 t8 T6 \- ?' R" J
try : y( d2 d5 M7 R% V/ I+ Z" B# W, m6 l
{
- T" J; p- q" Z$ E6 e: w- D0 _. D // Enter the path to a model file! 5 s( ?! J4 \7 ]8 |' ^
simple.LoadModel("C:\\Models\\Test.spp"); 5 l y6 d% `2 R$ M. I; z
}
9 c* h0 a# k- w6 _3 K5 q7 Gcatch (e) . _( B6 @$ C* K6 f& `
{
, ~. A8 Y J$ w5 R6 [* s WScript.Echo("Could not load Model!");
3 |& U! [! d& B3 M% `8 C* G WScript.Quit(); 1 d4 E- Q2 Z$ N- ^
} . z" r; ~5 @9 d1 y
* {" e" Q+ B. b0 o/ K& A
try ' n+ D. u$ _# {2 R4 }9 E
{ $ j8 ^" x# m/ c' I! ?$ P% S# w$ j
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ ~. Q$ n2 s7 Q; w" K7 @* x" P2 x) d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 @8 W% e' [/ C/ A if (r == vbCancel)
3 E& ^; D$ b( m$ K7 }7 k5 j {
# x+ l3 u$ m* @) Y# ]) ?4 c/ S simple.CloseModel(); 5 ?/ R0 E8 R& D; r& f3 c
WScript.Quit(); : X* t0 E, S' i5 S% e2 r
} 1 i- R8 t5 a: I6 X w. J1 _
}
% v) E, t7 p2 P( r: G4 U& K
4 W) l" `6 E/ Q* z- lsimple.StartSimulation(".Models.Frame.EventController");
9 x# a' v, b( N- T # V0 J4 w8 G: M E1 z3 Z
if (simple.IsSimulationRunning())
6 v; }) L, j* N* F/ N; P6 K; T1 z8 ? WScript.Echo("Simulation is running!");
! ]8 ?. _" V& y" Y
( Q9 ?% Y2 m% [- F7 k( N( [: V// Wait until simulation is finished - l' m9 n; c0 {) W- r0 d
while (!Finished) WScript.Sleep(2000); : o4 D9 [# R2 V
& d- C, O8 B, q& g/ a2 a3 Q+ xsimple.CloseModel();
1 a' P, q( ^) j$ V& e( o. ysimple.Quit();
; D& S4 j8 [3 t( DWScript.Quit(); " {1 d2 _1 I: O6 o2 J; z( W
- W4 m8 p) I8 P# u1 `/ n
' q9 R1 w' _+ b0 `* }3 Q6 w* R; ifunction RemoteControl_SimulationFinished()
- i* a& `. O& q# h d2 E{ 5 g% ?" X. K' } L' d
WScript.Echo("Simulation Finished!"); |