Example of a JScript 8 I% G8 l" G3 P H! J- R
var vbOKCancel = 1;
: A/ {6 P4 v# T' v% B, [var vbCancel = 2; 5 o7 |' z2 U% X
var vbInformation = 64; 1 b% Y' B' L: E' h' O. M+ N" V/ D2 p
var Finished=false;
+ a8 Y: e/ N+ W- s% U$ P9 K
, h! o& E$ C; Q2 [8 X6 Zvar WSHShell = new ActiveXObject("WScript.Shell"); K2 g5 P! O2 B) F5 w6 x
: X5 x$ R$ Q$ m( o: V' lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 z) n0 F7 V f6 \5 O8 g8 P
1 l) Q( _8 h5 a( Q- s2 i
simple.SetLicenseType("Runtime");
! |( q/ M8 n' V9 Z( |* J # u4 c6 V: X3 B
try
# V8 |1 w) c( A7 v' m{ . U" z- L; K o
// Enter the path to a model file!
4 T# V! ^( W) f- J. |: |6 r: I simple.LoadModel("C:\\Models\\Test.spp");
& ~. S# t" x+ f3 ^* J, e6 D& x} ; f$ e1 F) [8 E# r' U' M/ k3 w
catch (e)
9 `' e- s) ~) V2 |. H# V{
/ r! Y/ [+ \" v WScript.Echo("Could not load Model!");
8 ~: B" r9 [- O& P WScript.Quit(); ( B. I4 r& t) U
} 3 Z1 Q! B, m! a2 n9 I5 O
2 O( F; |6 R b# G& Etry % B& v) C2 @* w9 ~' e5 |; r
{
: n: d9 O' g: R0 n1 @5 n. s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
w4 K( A( h9 L! J1 \& X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ y7 C' F" c5 k% o! | if (r == vbCancel) + S' Z3 P8 u G+ y2 F
{ Z* s2 `0 w6 T( m5 _$ W8 ^/ p
simple.CloseModel();
: \- Y8 |, b$ Y WScript.Quit();
, |8 z+ ]9 ?! A, |7 J% v' y } 2 @4 x0 z/ U9 z* B; R! ~
}
8 e4 r6 W& K* G7 t8 v- g8 u* q 5 T, h$ Z& S) j! c6 X
simple.StartSimulation(".Models.Frame.EventController"); ( f4 h, }/ ~9 ~ J4 [" r1 T
% y) b4 k! _4 Cif (simple.IsSimulationRunning()) % h) s* w' e3 F, X( l% e
WScript.Echo("Simulation is running!");
8 V2 b ?0 N# }8 R9 G
* Q+ B) v# t u% }// Wait until simulation is finished
* t) B& ~; x) q. T5 Zwhile (!Finished) WScript.Sleep(2000);
1 a- S E8 O4 s& I5 k4 s1 `
# k$ |) ^ z! ]) zsimple.CloseModel(); ( I" P; C4 I5 Z4 `
simple.Quit();
1 E5 v3 q9 ^# R0 _1 ZWScript.Quit();
! ^$ Z6 S2 E3 ^3 ^2 ?4 s3 v. P 4 v! \: ^, j. d8 l- n2 r$ f0 X
3 n' \: X4 L) ?4 l/ C1 c/ P5 h. Dfunction RemoteControl_SimulationFinished()
2 D' y9 w3 v: y2 z$ M{
: q# T$ u( K6 K WScript.Echo("Simulation Finished!"); |