Example of a JScript
5 P4 ?/ T6 ^- U! N! M. _. W" fvar vbOKCancel = 1; / {* b, g& D8 l! r
var vbCancel = 2;
6 a t" p' f! x- B# Jvar vbInformation = 64;
, R% R2 s5 G0 b# |# g: ^% Yvar Finished=false; # g1 Q/ i* e3 x6 X& ?5 Y$ @
% x) N( y' ]. V+ C! |5 p
var WSHShell = new ActiveXObject("WScript.Shell"); 3 y k3 |- I6 o( b
) U8 \+ M7 e: t* L% G+ wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# N+ v9 g6 c+ b
- A" F K8 O% W/ L6 r& Lsimple.SetLicenseType("Runtime");
, \3 l- e; o4 w 9 a+ G4 n- n9 R
try
( R% O* J+ Z g* `2 Z{ ; e7 p% x9 p! Q- v5 F ?5 b! C! |
// Enter the path to a model file! : b4 m' g+ L/ W: U2 H4 y
simple.LoadModel("C:\\Models\\Test.spp"); 5 P3 R% H: b1 n; p8 @' H3 `
} ( f* J) w2 k3 k' p" E! ?
catch (e) : ^* g2 U$ \5 b) ^
{
% G& ~, q3 m8 e: }, |% \6 Y WScript.Echo("Could not load Model!"); $ ?1 V' O7 L) j
WScript.Quit(); . w5 }9 j$ {, j1 f: r
} 2 u7 a8 b9 H8 I, {# t
9 n0 O1 Q9 M( [$ \! ttry
+ E, v9 d- G( k* @$ Q# D$ X0 r{ 3 g6 C' M0 `! w: E5 ^' d* a( x: X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 Q7 n1 b0 j$ f! D& ^- P1 ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); M" V8 [1 u5 K: y0 l4 Z
if (r == vbCancel) 1 ]% d1 j2 f0 M G$ C
{
1 A: w3 p' t3 S- Q) D% v simple.CloseModel(); . W; g1 F$ d" x+ k5 j2 [! E7 y
WScript.Quit(); - s* {5 P9 Q/ l+ D0 ~
}
% Z% F |& `$ k& M, h} 5 {# V. l6 T3 f
4 l0 {& s$ u# @+ j& xsimple.StartSimulation(".Models.Frame.EventController"); 1 I8 ^2 U9 g; c* Z& u
! \* x8 R# s* E8 _2 D' o }; `if (simple.IsSimulationRunning()) A( C- o2 u5 V7 K
WScript.Echo("Simulation is running!");
5 ?1 p B! k5 Z" |5 a8 X w$ q; i& A% c2 m
// Wait until simulation is finished 5 f: v4 o8 {5 j( G" U1 m. Q
while (!Finished) WScript.Sleep(2000);
3 u1 E' l3 h( u2 d' ~
J, a: `; E, B; V- |7 g, ksimple.CloseModel(); . A: S2 `: q9 `9 E
simple.Quit();
* k9 ^2 n5 E4 y: [' M2 FWScript.Quit();
& l, o# T I; i8 f' `2 n- i& Q
( }2 q# i: {& w9 A" ~3 F8 T" ^6 |! G7 B
. C+ d2 k' I" ^9 j8 d9 E" Gfunction RemoteControl_SimulationFinished() + E2 x! @ h& b8 u: u
{ / X- ]( _9 s( _- i! g
WScript.Echo("Simulation Finished!"); |