Example of a JScript ' F; a& g( S5 Q4 {3 Y
var vbOKCancel = 1; . [* P# E$ G+ _" I7 v; _2 G
var vbCancel = 2; : V2 w0 m1 W4 e3 h& q
var vbInformation = 64;
1 M& E, K x" M$ T. Fvar Finished=false;
, L' T7 k4 [3 a( s9 B
; J2 J, ` i6 V8 E9 l3 z% Rvar WSHShell = new ActiveXObject("WScript.Shell"); ( A' c; Q* i( ]) p' y
$ h7 E+ C N3 s8 ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); @ K& {/ P& l' R' t; @
7 x: E; r4 V& H- ^8 u# c
simple.SetLicenseType("Runtime"); $ z5 Q6 v/ Y4 E4 t
( o/ e' t* g6 d' L7 U, ztry - q% T/ o6 e4 G8 c( P
{
# f5 t- r# A, q E // Enter the path to a model file! 5 ~ z5 z) d; {$ i' X+ b
simple.LoadModel("C:\\Models\\Test.spp"); 8 N- W! E1 H9 U6 S- a* j
} " X& N! p& m6 Z* v6 o. ~
catch (e) # r4 \( N( [7 l
{ 0 J0 K9 |) A6 a2 Z X
WScript.Echo("Could not load Model!"); 7 w4 w' d3 q) K# w% b
WScript.Quit(); - u+ H: F6 u0 L- P7 \& E* j
} 1 R* M: E5 R; ^) i; n+ `) k
( {, ?- L- i2 }, Qtry / h. d* l. ^, F% t
{
+ o. Z5 e, P; ^$ V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 e: ~8 o$ G# x) Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; D4 i4 R& w; M5 S
if (r == vbCancel) . I$ s, h1 [! \1 n
{
; M0 y, E8 B$ ?" n' {; t' U simple.CloseModel(); / ]5 }4 g' \# j- L
WScript.Quit(); ) R! |/ E' O5 c- ^/ H3 F
}
8 v- @% @6 r X: g2 x}
, p0 e$ B* c5 e
3 V4 `0 J" R8 G: P+ A' j3 B* }simple.StartSimulation(".Models.Frame.EventController");
# `* }. I3 V8 C+ l8 @ 4 ~1 U! L) g( Q
if (simple.IsSimulationRunning()) 6 L6 d7 k( f. O2 ^9 X! W% T# F
WScript.Echo("Simulation is running!"); Y! j" l! l' G2 e7 L+ Q$ M
3 t# G) y+ J+ I9 Y' J% V1 \// Wait until simulation is finished
6 m% z" z0 V' |while (!Finished) WScript.Sleep(2000); : k2 i- V; U/ S9 Y: ]
* b0 D5 K/ B8 F- A% b$ L$ d. d
simple.CloseModel();
# ^. X# d0 _& \: Ksimple.Quit();
2 g) @6 ], W1 H, S& ^8 l9 EWScript.Quit();
5 i0 X+ C J8 C# B0 s * Y# q! x+ o5 v6 {# ]" U- t$ K5 i
8 s8 g8 N& R F) @function RemoteControl_SimulationFinished()
% q. M7 m; r9 F" O( T{ 7 J& l& g$ C, x. c1 V$ N% E
WScript.Echo("Simulation Finished!"); |