Example of a JScript
$ |: G) G; Z" qvar vbOKCancel = 1; 3 e d. Y, q( {" g3 H+ Q& b
var vbCancel = 2;
9 O y- K4 P# X9 e6 r* j# |var vbInformation = 64; " v; w; a8 D# l4 Z
var Finished=false;
' Y0 n4 q$ C; I7 q/ w1 }
+ T6 N- `9 s5 w6 Z( Zvar WSHShell = new ActiveXObject("WScript.Shell"); ) M9 ^" j$ l. m6 n5 s
- o) o0 ?( w5 D, a! f
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( [! }& c- c; K2 y
1 e* R) r7 s; ~2 v) @# msimple.SetLicenseType("Runtime"); 1 V7 j* L' @/ J% d8 @" O$ W
/ k+ @ d0 L4 E; g
try
3 n6 ]! [0 A. w, i: t8 X* C- |4 Q{ , a0 X+ q; m* ]& f I4 D
// Enter the path to a model file!
( n9 H6 N9 P. d0 l1 M4 m9 E simple.LoadModel("C:\\Models\\Test.spp");
4 x* \5 u4 \8 H# |}
- O$ u7 h2 w _catch (e)
8 ^+ G' }$ j( q9 r{
& c: l. H: M* L5 j' T4 w5 ^ WScript.Echo("Could not load Model!");
0 f0 p: ~1 V8 W! @! ? WScript.Quit();
0 [1 n/ F1 R, ^5 R$ C; F* I$ V} : [8 ]0 {+ B- d* b8 D0 A U
0 K# o! e) Z9 n r/ G+ stry / D% G- ]& T* }& u6 Y
{
% M& c- C; q$ s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , C: [# E6 \: Q }; Z* o' n
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 W/ A" u0 o! O3 p4 `9 i' u$ p if (r == vbCancel) q* X; V' l3 Q# m8 u0 s
{
7 y- Q1 d: ?( W! _1 t& e. i# k: z simple.CloseModel();
, @) y, h5 M# D$ w" t2 V0 a WScript.Quit(); 4 s/ C4 x2 F {) s( p
} 1 r! o/ E9 U0 R/ h: d" ^
}
1 m3 |/ x& g6 H' |$ u Y
4 b% a J, K F, k* ~" C. [simple.StartSimulation(".Models.Frame.EventController"); : r! ~6 F/ ^9 X Y$ n+ m
: w y4 ^& R8 ?. L* [, Sif (simple.IsSimulationRunning()) 7 _' T q4 v) \+ K
WScript.Echo("Simulation is running!");
" I# L3 M) e( O# I c% i1 J$ j9 ]; r l& Z
// Wait until simulation is finished
/ E. r; p) f6 D9 Zwhile (!Finished) WScript.Sleep(2000); % e# D/ J3 }2 R' c8 X
* z9 f+ w; t/ K- s1 K! W
simple.CloseModel();
7 o# j4 o$ T1 [# T& psimple.Quit(); & D6 `5 D7 M9 k' U
WScript.Quit();
# X6 L; L& c# s) w9 p
* a0 e7 c4 W7 w, P+ g. j) ~ : ]8 P0 U5 M3 W- P7 u, |: n
function RemoteControl_SimulationFinished() . _$ P8 j/ t$ C' X+ a+ V8 Q& s
{
% q$ U/ N2 s( y8 o* {' j8 D WScript.Echo("Simulation Finished!"); |