Example of a JScript 0 N% A+ J+ q# Z" p/ b* Z
var vbOKCancel = 1; 9 o% N) X8 ?, T+ K8 m1 K2 A& }, m5 k
var vbCancel = 2;
+ P' h% T8 d) m# |! E+ D2 svar vbInformation = 64; # U2 |* b; q2 D- W$ `! T* [
var Finished=false;
1 _1 `1 a" n: N
+ c* @8 y2 K# ]var WSHShell = new ActiveXObject("WScript.Shell");
9 y2 L! M: t r* e 0 p7 b* } y! @6 U& ~; |! Y; F7 z% \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" V. `/ {4 Q( Z* Y
! Z% ]0 Q, f. s: Z5 a, Gsimple.SetLicenseType("Runtime");
N1 o3 D, I/ V! ?) p/ @& E 3 k# o' E0 L" c) n6 I3 k! t
try
5 a6 M9 _/ ~$ a' b0 D0 ^{
! i8 y) `- m0 J) h$ I2 H // Enter the path to a model file! ( ]! @) Q1 N& a5 n6 |0 `
simple.LoadModel("C:\\Models\\Test.spp"); 2 V* H$ _. ], _9 q) [1 C; D7 n9 [
} 3 ?7 G3 ]8 t4 r$ Q# f- i
catch (e) & n% w. q( d$ Y0 y
{ , M3 u1 o3 L) g6 w, D% ^/ y
WScript.Echo("Could not load Model!");
% x2 \( U* q" ]2 S o8 ]- f# R WScript.Quit(); 6 u% p" k+ d- _) j, \) b' W! M
}
+ X, r" d% g) ]2 I# ?3 ^1 L: ]9 M : _+ ^+ `# C% Y! B
try
4 a5 d B4 U$ D4 ?5 B* N4 R, t0 g{ . [8 |0 G5 {" y, D" a, d; n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' v. C' _+ w; \" h, b; e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' V2 Z+ W( q& A$ ], ?2 x1 O! y' { if (r == vbCancel)
' Q( V4 x, z1 R% h- O { % U" [0 G7 z6 U1 f9 e
simple.CloseModel(); 8 r) Q, K* V2 b* d
WScript.Quit();
: h+ U9 {' j! l+ m% P- q0 ^, a }
: d# _6 ]. y( M$ ?+ r7 F2 j$ j3 l+ Q} / o8 ~4 Y' ~" l
+ w1 r% @ u* t( H7 }2 N; ?simple.StartSimulation(".Models.Frame.EventController"); ! B5 s& ~: K @! R# y
1 i/ L. h! V' S( F3 nif (simple.IsSimulationRunning()) ) T @0 y* H' u, g, N" ?2 a/ V
WScript.Echo("Simulation is running!"); . M/ t/ P( o9 \5 M+ n$ D
5 l" s Z4 {* d// Wait until simulation is finished
7 A( O( } C% O6 i6 J5 g: q* b9 Ywhile (!Finished) WScript.Sleep(2000);
* G' P4 P" C+ X9 p& B7 E0 w- G " H3 }: H6 N$ H. s3 r
simple.CloseModel(); 2 V* C$ N( N/ d4 g. P
simple.Quit();
' P. T' U( `7 e$ {WScript.Quit();
& G) X1 v# a/ V! k2 `7 X z$ k
! I V* e( b1 Y' n7 W3 [# F
/ N" u: f T! l8 Qfunction RemoteControl_SimulationFinished()
& H A/ t# Y* p$ Y1 K& L{ ; ^3 T& n9 @4 H
WScript.Echo("Simulation Finished!"); |