Example of a JScript
; A- {' o9 ?" J, p5 [6 q i0 ]var vbOKCancel = 1; 2 r, X6 U) A2 M; X- i) j0 L
var vbCancel = 2;
( N! u$ K* j, d; B$ H" @! Ivar vbInformation = 64;
2 d, @; R! D* z5 G$ z: N3 Dvar Finished=false;
2 ]0 `- A9 J W
4 z* ]( I! L1 L {var WSHShell = new ActiveXObject("WScript.Shell");
$ C& O1 u; V7 [1 `6 S, l
. h9 p* a P$ o. x( jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / q; [+ f* w+ P! C" q# y. V+ d
! s& Z" ~& }$ _: e1 Hsimple.SetLicenseType("Runtime");
* {# a9 C" y0 ` ( J. `' g S8 R+ |
try
; A$ e2 j' H, n. B2 n. `) d{ 8 D0 x4 u* _3 j6 {, R8 u
// Enter the path to a model file!
( ]* p3 o9 M6 v C( i simple.LoadModel("C:\\Models\\Test.spp");
- D4 u4 @' _' G7 e Z7 f} % b% U" L8 x# r( k: w/ V5 p% t1 m
catch (e) , _: o: y a ^% @
{ . o9 C* P, ]) g( J% D9 t
WScript.Echo("Could not load Model!"); ) O, v( ]. f0 l* o# r, X
WScript.Quit(); , a) d+ M& o, X1 o4 ~, |
}
, Z% v0 [# m/ F5 C/ Y
3 _5 `# f5 ~! D$ Ctry
, K) _0 a% M% E9 i{
7 [9 Q2 {. x* M3 Q$ J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ s' |7 I( b! y; c1 k, p7 C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 D; b+ X( g1 O! Z0 h
if (r == vbCancel) , {; ^- @5 U4 E% ]; c' R. Q
{
8 ?3 W; p E$ U/ y7 G2 K simple.CloseModel();
; U; D, m9 b k# K WScript.Quit();
+ b# b/ q/ h( C" C9 @ } ! x6 \/ O$ ]) g
} : M1 i0 c0 R1 M
+ g% F, T! L4 a; d q
simple.StartSimulation(".Models.Frame.EventController");
" ]8 |( F" M! Z! v5 @; @0 z2 ] " x$ W! v- x$ `2 y
if (simple.IsSimulationRunning())
$ j3 Z! o$ G( P8 V WScript.Echo("Simulation is running!"); / R1 a4 S& v$ C
/ y2 O1 p6 A8 {: m6 _9 L7 H// Wait until simulation is finished - K, P& ~; A1 z$ z# p5 {" j
while (!Finished) WScript.Sleep(2000); " R/ B3 u4 z+ s6 i/ C7 [
+ R0 Y c2 `( C- usimple.CloseModel();
4 m3 d& n& K2 l4 v: q1 }, @3 Bsimple.Quit(); : p5 [, T& a1 }+ t2 F
WScript.Quit();
: v' c- L- s6 `" r
* x$ H+ b& E& c8 z V8 c: a; j
# }* s# l8 ^, J/ e. b! i+ a0 ?9 ?function RemoteControl_SimulationFinished()
/ z9 t2 q8 x5 N- U% \& {0 d, Z{ ! ]4 ~4 N; h" |* b7 b. e7 M
WScript.Echo("Simulation Finished!"); |