Example of a JScript ; u" q% x U, q
var vbOKCancel = 1;
/ G2 h1 V+ d Mvar vbCancel = 2; + u+ C* t7 @- B2 Y
var vbInformation = 64;
2 F# P& I, E1 r4 Ovar Finished=false;
. F+ ^7 V. F, m! f5 q/ I- T 2 F* e% q! N; _8 L; K; c" `
var WSHShell = new ActiveXObject("WScript.Shell"); 7 I) U1 M/ ~/ S$ K, ?& k
! K: V0 ]- x" G+ f `' {( d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % h% Q5 a; m" |, W* @9 d: r
& q% f* ^/ E# a: csimple.SetLicenseType("Runtime");
, |* v. w; g- o% a/ A9 F0 x2 H , ?1 \) \! N( h- n, H
try ( c2 m5 Z' k7 u3 u+ {# w: r
{ - Q* [, F0 ]9 A! d: ]2 K
// Enter the path to a model file! $ N2 O- v" l3 j: D1 Y$ p8 x- \
simple.LoadModel("C:\\Models\\Test.spp"); 3 t. ?0 L7 m8 {6 O
}
2 X. B) r9 ]3 B+ |catch (e) 3 Q U5 T0 m& N, v$ S; M
{ 8 n' S2 T* p6 b
WScript.Echo("Could not load Model!"); - A' ^) t i. q5 R9 n1 }
WScript.Quit(); - y0 G% I) o$ Z: D- K) J
}
6 a* c% C4 c. L; W8 c0 @ - U# K3 W: v5 {. E0 O5 c
try 3 P& b- a* ^) y' J* K" o+ b. ?
{
/ i" Z6 Q0 A3 X! n" i4 ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 u3 {/ Z# P6 b; q+ U0 r$ {1 ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' r& {3 {5 b2 I if (r == vbCancel)
- z D3 k' T- D0 _ { 3 w' X' a+ S5 u2 h# X0 }( Y6 S
simple.CloseModel(); 4 R) }* a/ v% B1 N4 B6 C
WScript.Quit(); $ d; X' L: D4 o/ z4 I' x
} v) X& L+ o* o! {, w
} 7 K3 c$ I; b+ }& c
% V1 b7 t7 i5 b+ _/ R2 K! m: W7 l# Msimple.StartSimulation(".Models.Frame.EventController"); 2 x3 |. N7 O) Z4 D
5 J6 m) b1 v. c8 }if (simple.IsSimulationRunning()) 2 W+ |* x# B7 a: v1 v, ^% Q& E8 J
WScript.Echo("Simulation is running!");
/ W5 W" @# V: q+ Q" i- d & K% g9 A) ]" o7 I! A/ Y
// Wait until simulation is finished
' m1 ]2 o& N0 l0 k9 ^% y# Kwhile (!Finished) WScript.Sleep(2000); " l* p7 j8 z2 c
1 i! w h0 f7 Qsimple.CloseModel(); $ |) u. y: M9 ~0 i. ?
simple.Quit();
% q) O( |# i% ?& d: v: _( HWScript.Quit();
0 P0 ~! u! s' `( o " [( O. @, G# f
: ?2 S8 N: a' ]
function RemoteControl_SimulationFinished() 0 N. e, H, r$ v) r/ R$ C
{
2 E9 y' {& N( q( p( P WScript.Echo("Simulation Finished!"); |