Example of a JScript
( b" ?. [* r- S! Wvar vbOKCancel = 1; + x) j. w: a0 }0 B4 O
var vbCancel = 2;
% k9 _ R5 f7 [1 v) c" A1 Dvar vbInformation = 64;
0 @; d) F) A" Tvar Finished=false; * c/ c7 W) d: R2 \/ O/ `
+ y4 M! ^3 l b& E, Q$ ?! ?* ]var WSHShell = new ActiveXObject("WScript.Shell");
: O0 L b( x8 ?; W6 ]/ ` + s( L/ F- p0 R4 M$ e5 E
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! f/ n1 D" [( K8 i
, |; H2 s0 I7 c9 _7 U: g8 W
simple.SetLicenseType("Runtime"); $ z8 o$ W/ k, q. Q0 B h9 p% W! }
& n0 Y7 u) X0 ^* n
try
0 j; E2 R0 d2 Z4 C) D{ ; u& V5 v. S9 R7 a/ m2 `& _
// Enter the path to a model file!
) ~3 M( U) |0 W simple.LoadModel("C:\\Models\\Test.spp");
& ~! | Q9 K, D( _' j9 U6 s} 2 G+ M; t) A' g
catch (e) & y( b: j2 D E) k G* A* s4 J
{ 8 J7 Y( q: O- o9 V
WScript.Echo("Could not load Model!");
, J# N2 e5 t. H9 _) ] WScript.Quit(); ) C: O& L' |2 Y$ p1 l9 ^ m
}
9 W* y' b( i9 |2 V1 D
5 ~9 } @, d8 itry 5 h% I# m" k8 D
{ 0 e8 I4 _$ z8 V$ Z5 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, n; @- U) h/ F7 U8 {, _" e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 v2 `; J w5 c& k if (r == vbCancel) W4 U( v7 |0 v; o2 H* B$ ]. w/ @
{ 6 p9 ?! N8 l7 ^/ N
simple.CloseModel(); 6 ~. A. h. D( y) K1 X0 t; X- V
WScript.Quit();
& Z3 x1 x; q0 C2 b, E }
; N4 k/ z. }' }8 o}
( _- z+ h% A! D9 {% f @1 n
R8 x, d$ S8 Isimple.StartSimulation(".Models.Frame.EventController"); 8 C) v- U# f$ o9 H H
( m, x. |( r, J1 u) R# \# v) Gif (simple.IsSimulationRunning()) . X) b( M# k H( _- N1 C8 S
WScript.Echo("Simulation is running!"); 0 A9 ?8 d E5 P X+ s
; ~ P! y. c5 w- m! H0 Q$ r9 B
// Wait until simulation is finished # u8 q$ @: E( P! m
while (!Finished) WScript.Sleep(2000);
- s1 u) g" \4 H6 ?7 b0 A . F2 W. I8 Z* q7 J# j( R3 v, X
simple.CloseModel();
$ c! [) U C2 M. v# d$ z+ y7 b6 @simple.Quit(); 3 {2 B2 f" m% |4 z% [# B0 A
WScript.Quit();
) Y( q7 R P7 [1 e T
% F& t T: W J: d 5 Z+ e" N. P% C' }% a
function RemoteControl_SimulationFinished() - k- q- |; H2 t# a6 C
{ ) |8 _- f' Y0 R* C! c
WScript.Echo("Simulation Finished!"); |