Example of a JScript
+ r }9 Z9 `9 r: v! w+ j) ~$ Pvar vbOKCancel = 1; ) y% A2 N# C2 b/ L
var vbCancel = 2;
+ o" S9 t$ n$ I4 M8 o x8 ]var vbInformation = 64;
& I% @, _5 Q! Y# r' O/ kvar Finished=false;
: E9 R" d( P; U* z7 h
: H8 w( Z P! P" R$ `7 W; Nvar WSHShell = new ActiveXObject("WScript.Shell");
8 }; F @9 B; N7 G% `$ e% K; z / A2 q% ?6 d3 s& g, p5 N G! n, k
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 l9 _( q8 q! ? 0 z* k9 V3 d2 g7 U1 X* R
simple.SetLicenseType("Runtime");
) t: l- }/ ?4 X8 q# e+ _0 x
, z3 ~5 x+ X4 I; c0 ntry 9 Q0 Z1 e# b# a" _3 c% y( G2 _) g
{ ( W& y7 n& D$ _% U! R
// Enter the path to a model file! 3 b9 a% K& g% v/ P4 _4 e$ e- r5 M
simple.LoadModel("C:\\Models\\Test.spp");
' p4 F; z% ^5 H0 k; E1 W0 \9 ~ \( h}
8 H' X3 t0 f& h. jcatch (e) 9 b9 O, W6 A8 M, D1 V
{ 8 ]: f9 P2 d. j
WScript.Echo("Could not load Model!"); 3 _; ^7 u+ a7 l: G
WScript.Quit(); C# i+ p L+ `8 X6 d
} 4 g5 r0 e/ f" |
) z+ ]7 D+ B6 }9 y7 k; o
try 6 I4 r/ O- t1 ^
{ 4 R& {0 K$ n5 r2 S5 W" N
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 G: H8 i( P9 H8 @8 O6 ~* l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & O: E) L4 N& \$ k, y& P
if (r == vbCancel) - d, k% O) U# }0 L
{
2 L& L* n& n2 z simple.CloseModel();
) K& k" B; J/ M WScript.Quit();
7 n, s6 q% f/ |/ e3 n5 V }
+ s5 f. G3 A$ b} 3 w4 C5 f6 P/ ~. s
( {, W) t8 b# g* @, ?6 P0 g( usimple.StartSimulation(".Models.Frame.EventController"); + p5 C, b2 J/ i" E) I1 K
5 |; A2 _$ R0 i$ R/ y
if (simple.IsSimulationRunning())
# @3 k5 k: [/ ~5 T1 N. e, U WScript.Echo("Simulation is running!");
9 w8 i B' r9 u# F + |# F# S- o; e4 o9 Q" e
// Wait until simulation is finished $ i7 l* u h( z' ~! J9 `) u2 o
while (!Finished) WScript.Sleep(2000);
0 h# x( a2 v7 J) Z5 r- _
% B% a" N* p4 @. M2 g7 z Q; E* T. ]simple.CloseModel(); 2 r2 \1 l) e$ s+ _
simple.Quit();
* c b5 c5 K9 {/ M- C8 H( ?WScript.Quit(); # Y1 ]! b8 G" m/ E$ M( v0 c: g/ A
8 U. S2 Z- m) W3 z( g; h
$ \2 P. b" P9 V0 }. i' A: `3 n* Ofunction RemoteControl_SimulationFinished()
: }/ m- J% C1 |7 @' u; I3 g{ 0 k8 t! g% a4 n9 h" M& B
WScript.Echo("Simulation Finished!"); |