Example of a JScript
5 k$ h( \$ e- D# H9 ?var vbOKCancel = 1; ) h1 K3 q: M- H# h; N& `8 i3 g5 v7 w
var vbCancel = 2;
2 p. h: J7 s+ I2 _/ S5 H! |/ gvar vbInformation = 64;
3 O" a1 ]# q+ K+ rvar Finished=false;
2 S1 [; ]' Y" j+ a : ]8 |4 p( h( V3 G2 M/ ]4 B
var WSHShell = new ActiveXObject("WScript.Shell"); . O- P7 a: B9 y3 t! @- B$ j5 \' A
% D. [( s$ i/ w. Y3 C# @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , J+ {: C" {1 r& T8 M" h7 N
4 c6 m% j; F2 a; e/ Y& b3 S6 |
simple.SetLicenseType("Runtime"); 0 D) z# A" I3 K# b% T& F
0 r9 a/ C1 n. [4 F+ k
try
8 X' ^" e6 V: Z O- W. q{
9 d& J. R& S8 Z9 T // Enter the path to a model file!
6 e( W1 w7 z y5 V h* ~ simple.LoadModel("C:\\Models\\Test.spp"); 9 `; `* D& u' H* M" W3 I; @5 _
} # ?% ~$ P8 D9 Y" T1 M8 M
catch (e) ! _& J( h" `7 w1 G# l" I4 c0 E
{ ) k3 P. g, g: R7 Z1 i3 t
WScript.Echo("Could not load Model!");
) i: r0 @% c; _! W) ]4 c4 ] WScript.Quit();
/ M8 b$ k4 V' N+ i* I. }} , J( `4 O1 c( F, m4 S( V7 M
) j: ^3 k2 } x' U* z* S) ?/ Wtry
0 z1 ~1 R( M3 V/ h4 {, U/ n3 B. Y3 C6 u{ 8 @; |- ~; ^' i; G9 \% t- J+ L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 F6 V) o2 B7 S5 X4 v r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( t' i1 M# i2 M' I if (r == vbCancel) , |/ ]( F5 f2 X8 F2 I) V7 Q' z
{ + _2 w* m& W" U! {3 v
simple.CloseModel();
c" e4 v9 J& W" Y WScript.Quit(); 1 s5 n. Y5 T% o5 p' j. Z; p
}
4 d5 O+ R! l6 `5 Z8 H4 W" w} & h0 _+ p2 s0 z* o! H+ m
, m8 u! c" ]4 g. K0 `5 @
simple.StartSimulation(".Models.Frame.EventController");
/ A0 k! I) D$ M8 l4 J { $ V0 q0 ?0 ~4 d. p6 H2 D4 m
if (simple.IsSimulationRunning()) / Q+ @& c: l3 ]
WScript.Echo("Simulation is running!"); & J. m7 k$ C# t) O# }2 ^) I6 S
# l1 s+ ?$ V% G" D: Q9 s8 [// Wait until simulation is finished
* o8 B; }, v- f% } Lwhile (!Finished) WScript.Sleep(2000); / s7 B6 U& n0 V8 L1 N( r- F
, \& Y7 V6 i# o4 H. [
simple.CloseModel();
0 C* s* b* g2 ^9 n. e, gsimple.Quit(); 4 n7 H% b5 Y, H! a: E% v: ]
WScript.Quit(); 3 C# P l7 r( d7 A
( M4 r" p' N8 R0 V- N4 ]
4 [! R& d! Y" Y3 i/ nfunction RemoteControl_SimulationFinished()
' d3 y1 g- Q$ Q K0 x{ & w" X- F/ P) W4 f3 J J6 v
WScript.Echo("Simulation Finished!"); |