Example of a JScript
9 n- C7 i+ t2 D+ \' S( K) _- Xvar vbOKCancel = 1;
. ?7 F6 t1 Q# |! B" t. Jvar vbCancel = 2; & n7 H" K$ \" ^5 ^2 w
var vbInformation = 64;
6 M4 } p2 j3 b% Evar Finished=false; - I) V/ X9 {; N* W& a
' R7 R. C f X K& s; w$ `var WSHShell = new ActiveXObject("WScript.Shell");
( F. j$ h* c$ u; n
: L& x$ T6 O9 H2 g9 [var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - I3 K4 r5 k1 K: l2 U4 @" z
% k, p" p) d2 x" d: Z9 O: s: l( b! |
simple.SetLicenseType("Runtime"); 6 U r" N. J, q# _1 L/ R) [9 ]3 p/ ~
' g) r3 N9 F* ?% Y
try
. e! _- P y! n{ + T) |4 G7 y2 ^
// Enter the path to a model file!
$ m& f/ L: o r' Q simple.LoadModel("C:\\Models\\Test.spp");
" {, g3 q! m7 O( d" v7 p}
) L# ~. x% n# w5 k# v; Ocatch (e)
, G+ T H8 f3 k0 a9 f1 e{ 0 v/ A8 D7 _( ^
WScript.Echo("Could not load Model!");
+ n4 A! f. a* I3 G0 C0 Z; d1 o2 ~# | WScript.Quit(); 6 s1 h' U8 ~7 {* x
}
/ l, c- p( u. [# g- t( W9 m0 E) ~ 3 S# d* F- }& T" W: c
try
! H( a+ C6 d3 n' c7 x, ^{
. J; j' P, [* W, W% ]+ f, L' _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # | E" H$ L/ m: d. D0 n) G$ n* _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) X" X: S% _- c, G" N* [' R j# X
if (r == vbCancel) " r5 b q. r& d' f7 k7 Y
{ # u1 s9 E5 }* |% u; C n
simple.CloseModel();
) \, b% v5 r# L0 I0 D" K WScript.Quit(); ; J! E7 e& o2 I5 \& U3 V3 d
} % I2 V9 t2 K0 Z1 S0 T9 W
}
9 v3 J. W& s w2 ~ ; {. @) ^ Y+ @7 \, i% k2 k$ N6 X, f" N' j
simple.StartSimulation(".Models.Frame.EventController"); ( u( v$ V, F5 m; K! a% `3 E4 N
& g# b( N- f9 q( I- vif (simple.IsSimulationRunning())
* Z$ m9 b, e; R7 E1 [ WScript.Echo("Simulation is running!");
: o' i5 A: w# o 4 R% u# I* \5 X+ I0 O' @, u2 m( N" T
// Wait until simulation is finished
! R$ d+ u* u) n8 g$ t; Z6 a3 Lwhile (!Finished) WScript.Sleep(2000); + f9 c/ q8 H& S) X
0 n. B) I, U; p4 K0 c$ lsimple.CloseModel(); : G5 i: _4 @: |' B7 s: r2 }6 }, d# i
simple.Quit(); # I2 j6 n; F. p- j# O% Y* b( O
WScript.Quit(); 3 d0 p! n+ T5 N) p$ ?" A; A
" ~0 l9 \ F% G$ B
' z$ t9 R) e! U
function RemoteControl_SimulationFinished() 8 `5 B. `2 G$ o; Z6 J
{ ) g2 F% [% f' s2 ^8 S. I
WScript.Echo("Simulation Finished!"); |