Example of a JScript # r* K s, D' c; _. K6 E8 x! L
var vbOKCancel = 1; x3 Z! i' ]" N: `: X
var vbCancel = 2; ' c% p7 x" T" v4 T. d" o
var vbInformation = 64; ' ?0 y" g4 |2 O5 `, ^5 B$ K
var Finished=false; : S+ c# P( h5 v" U h0 _+ a- j
- L1 V- Q) h9 z. Q0 ]( U7 w
var WSHShell = new ActiveXObject("WScript.Shell"); , I- {7 {- T$ C* o* D# v; _
5 t7 w8 p! e. p5 Y+ x B/ B5 uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , d. c1 M- T5 t
/ c/ X3 V2 H: n% ?simple.SetLicenseType("Runtime");
$ C! e0 u" l) F6 q
, h% A7 h( T' _6 c/ x+ gtry
$ c) ^, D8 @. z+ e! u& T{ 6 r7 l/ r0 S! ]# F% T3 }
// Enter the path to a model file! ' a1 Z5 t; `" d
simple.LoadModel("C:\\Models\\Test.spp"); , i4 ?) m7 ?, D' R- [
} 8 |: s8 d' w. A, F3 T( X1 k
catch (e)
8 f. j. N+ a; v: i: F1 V" z{
8 c( z2 @% n& F1 E5 B7 ] V s7 o3 I WScript.Echo("Could not load Model!");
0 H& `# a$ V; d8 s7 Y$ U5 ], C3 N9 ] WScript.Quit(); ( K, C- S' u1 G. D) J
}
+ |1 _ h& R, M
" g+ q% O, k: Y8 b3 I( jtry 4 e: J# h. ]0 L2 \( h9 |
{
4 c, z, x6 f% m f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 l4 I) L8 N4 Z/ e y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 n6 x3 J1 @- _, g' C if (r == vbCancel)
, V0 L3 b% ]" i- U { 1 C3 k* O% L* G$ u8 k
simple.CloseModel(); ' x& R* q) \4 d; V! V+ {
WScript.Quit(); ! V' r! W" |* r2 m: I
}
7 g+ f6 a5 H% K( k. p% S5 ?}
5 C+ ^/ c' C# k [- i$ M $ |; E. K9 G- v
simple.StartSimulation(".Models.Frame.EventController");
% P2 `6 G* q: _: x/ D' ?$ a4 B1 Z* B 4 s' @+ n5 Z" K7 ~- K
if (simple.IsSimulationRunning()) ~! y( _; U d3 b( V. ~% \/ y2 |
WScript.Echo("Simulation is running!"); , {- ^0 z5 A! d" U9 L' `4 a0 p$ @
/ l% I, k# _* x5 M6 b! D// Wait until simulation is finished + r( S" i1 K8 I3 b- ?
while (!Finished) WScript.Sleep(2000);
: G! K9 G+ E" q$ o2 H! v. A5 q ]2 R 8 Y/ U4 m/ v6 }/ {+ Z2 w* A
simple.CloseModel();
! U5 h! \& E1 x, _6 Xsimple.Quit(); # u" t0 f* {5 s
WScript.Quit();
! h% e6 Z% j7 c . d! [, F( Q j" Q) T( _4 S5 e
- s3 j3 ]( J6 |8 B6 P1 }8 Dfunction RemoteControl_SimulationFinished()
2 J8 I( Q) E$ L6 O{
# c4 e" ?! z3 V8 V WScript.Echo("Simulation Finished!"); |