Example of a JScript ! Z+ P9 I, h. W( F
var vbOKCancel = 1; 9 L4 g8 e: @9 V
var vbCancel = 2; - Z/ P2 y2 I1 O4 `
var vbInformation = 64;
6 ~1 ^4 a. A' K, ]8 C$ j1 w5 vvar Finished=false;
5 `( P+ V6 l* y6 S$ E% E
% d& U0 u( ?* ^" Y& V9 O( X6 w5 mvar WSHShell = new ActiveXObject("WScript.Shell"); / E% s4 C/ C8 Z# b T! e: a
+ e" d1 ~4 i. b0 {, M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ i, \ u# c0 }5 V/ C 6 q; S$ L5 \! z' m% {9 F
simple.SetLicenseType("Runtime"); 5 X% V' c& }6 e: S) n$ b
: J2 K1 k+ h; O3 L+ V* btry 0 E! E+ T B, F# y& X+ p% l/ q
{
` W2 C6 d/ z$ V, D // Enter the path to a model file! + M# H+ B$ O' H0 C/ ~
simple.LoadModel("C:\\Models\\Test.spp");
, K' |) t. F2 A1 b) F8 ]} W! ^- x& j3 s# p- b# k5 T2 J3 j( I$ b
catch (e)
4 r7 Y0 r: a6 P Y& r* `3 r{
8 j( ?0 p/ ?$ \/ }+ J9 d WScript.Echo("Could not load Model!"); / u0 s, W* a6 e1 h: W2 A2 v
WScript.Quit();
' Y$ c4 |3 K# h n6 k$ A} & Z b' f5 `* ]
P( Z% Z% _( ^
try
b: X) j. U( z5 b. T* b3 G- P{
! a2 M' K1 ?- D g, A8 i F7 q Y5 i& n simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ y V8 }) w" I r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- Y' ~) J0 F7 [5 Z1 d! j6 c Q5 N if (r == vbCancel) % \4 V2 ~& f I( x( Q$ H* N. t
{ 5 T- M. h# |/ G7 b1 J% u6 d
simple.CloseModel();
) t7 U( L5 h8 M1 `2 [4 a6 u WScript.Quit(); 2 h6 h" u5 h. r
} 0 c' f! G! @' G% f; E' A
}
/ V: u# p2 w9 S ) _( O) d9 y! @ B" N* O# ~
simple.StartSimulation(".Models.Frame.EventController");
! W2 X9 I. K% }: V
9 M2 D. }$ s( K! w# a7 T5 Gif (simple.IsSimulationRunning()) z/ `7 N% ~+ K
WScript.Echo("Simulation is running!");
" F$ c4 I4 p: A7 d( ~$ T. r # n% f+ |# y6 j, O" f/ n. p' x
// Wait until simulation is finished ) b8 S0 [& F9 s6 h# [1 f
while (!Finished) WScript.Sleep(2000);
6 q& [6 A* i' g # q& W/ v' n# H7 u
simple.CloseModel(); + t) w; h" _& ]1 V. A9 F! P
simple.Quit(); m0 `3 \& B5 A9 _3 J8 G
WScript.Quit();
% M& K" r- h5 U: B, k% v! T m
& J' F, U4 R5 ?$ |1 m
/ L9 u! Q* c- e/ Tfunction RemoteControl_SimulationFinished()
B$ J) Q1 T! k# g. p9 P( V{ & n) e- d! b( x f
WScript.Echo("Simulation Finished!"); |