Example of a JScript
) D4 \4 t% k0 A; f' w1 j6 u( |var vbOKCancel = 1; ; `& a1 H9 M! q
var vbCancel = 2; ( D1 A: M! }. X, h* O
var vbInformation = 64;
. f q" g; z, Evar Finished=false; 7 w8 `1 c6 \: e) J% E
' b3 k9 P6 s6 _4 ?5 }" _
var WSHShell = new ActiveXObject("WScript.Shell");
^. X0 V6 b9 W& Y$ a
+ o! U( m8 V& L! tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. H& w! W2 j" m8 S& y" T! y: n9 S $ A( o" P/ i7 e) d
simple.SetLicenseType("Runtime"); m% Q7 P8 [ Q$ C& O0 [: h0 o
! b1 T6 L6 ]5 K% d8 k% }try
6 e I7 [& q" k{
: ~$ v) P+ V1 l5 u" q$ J" n // Enter the path to a model file! % I$ N6 v$ v1 ]7 J2 P: X$ b4 n$ M
simple.LoadModel("C:\\Models\\Test.spp"); % F' _* n4 f) P# b. i% u
} . j9 K1 z \& J% z
catch (e)
$ h; L( x. j' Y b{ ) y' w* M2 d( i9 O" |- L- J
WScript.Echo("Could not load Model!"); + W1 J% J* Q' @4 o( s
WScript.Quit();
: d: a( _0 W* G, {: x9 \3 o1 v: X} : b0 Y' t, j' v( K
4 c- _$ o, `7 ztry
$ l" P8 M4 T d5 C" J4 b, ^* A{
% u \) h$ q# d5 U: v" y0 t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! h' k: p' j6 R% D8 _! d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) y* H; ?% W2 d0 b& L
if (r == vbCancel)
4 L2 L. y: M9 s( r* F9 p- x { 3 f$ r7 f1 M" `
simple.CloseModel(); ) B& o9 p/ ] A
WScript.Quit();
6 \) N7 K( H9 G4 T3 U2 R" `. M } 9 n. n+ w' |0 g
} # G9 a( H% [, W' A
9 i1 \* H+ E9 y% I' {. V4 zsimple.StartSimulation(".Models.Frame.EventController");
9 a5 H3 E6 m5 j" E$ D+ {( x' V3 i
; \1 a: \8 ?! T0 ^+ R, fif (simple.IsSimulationRunning()) - \: G O: b6 {: l# R2 S
WScript.Echo("Simulation is running!");
: t. G6 G* U6 c. k! [ E0 Z# t
) e' a+ n0 u t: \ [+ x) |// Wait until simulation is finished 0 p% j8 K; v9 I% k9 @* K
while (!Finished) WScript.Sleep(2000);
" w; U# e1 L: c. C
6 U, A& O! G- p! ?simple.CloseModel(); 4 o! o1 E6 n5 { p2 I6 j
simple.Quit(); $ `2 i7 {2 `+ ?& j. E
WScript.Quit();
s0 ]4 G7 N. S& a, e/ Y
9 o& P. n% v- p / P$ o! ^+ U8 \% ?) I( g
function RemoteControl_SimulationFinished()
1 [& t1 s+ x+ n6 @5 b{ $ g! {# Z& x/ O
WScript.Echo("Simulation Finished!"); |