Example of a JScript
$ U0 l0 D9 U$ u7 b0 I/ dvar vbOKCancel = 1; ! u5 |% _; X3 |( `- Z- l6 g
var vbCancel = 2; & k, B* T$ P3 w0 o( g
var vbInformation = 64; / q- e" q1 Q. K0 S
var Finished=false; 2 t6 b; [) D* F, D. L6 W
5 K) h9 F; H, D+ j
var WSHShell = new ActiveXObject("WScript.Shell");
/ U2 F" @3 [/ a & X+ m3 X$ r) J/ u8 N8 v/ I! P7 Q$ m
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! L+ |8 q0 T- d) D5 o
6 G" j4 v0 n& Esimple.SetLicenseType("Runtime");
; }3 X4 F" @. f* |( F2 n
/ S3 V4 v& u" |$ w0 _ `& }1 p7 Ftry
8 p. N9 s9 h. S{ ( P" @& w( K# w0 I) h Y7 I4 \
// Enter the path to a model file!
6 n% Z- \# [7 Y% b+ M; f simple.LoadModel("C:\\Models\\Test.spp");
4 `+ p+ w' v$ t* E" c. Y# e; I, E* {}
2 y; j4 f" W2 G9 q5 |% Q3 ucatch (e) ; a0 z% U, i& k+ G' b
{
! a9 L( \( `: F( R5 D WScript.Echo("Could not load Model!"); ) J/ ~" r( y" g Z! D; F
WScript.Quit();
, B) W, r. O8 Y: {' M0 X} : {8 \$ v1 h" d O+ H
! l+ ~3 Z% G* ~$ A" w( Dtry + C: {( Y8 t3 K* Q }+ U* c8 k
{ 6 E D4 ^$ {+ G/ T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 T# U* W# l6 l1 K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . y ?- }6 F) [; s7 a) T) i- l
if (r == vbCancel) $ R4 ?- n' F" f" n: |3 i
{ 6 n3 h# I% l% t2 X
simple.CloseModel(); ! R% C5 R+ m0 ]4 x: J
WScript.Quit();
# {3 [5 K/ I3 f! M4 J0 ^( `$ S } ! i; `7 {: q# o* C
} % K" I0 R' l: } O) l7 B
# y0 ^3 l# m' g. wsimple.StartSimulation(".Models.Frame.EventController"); 5 _) J% Z9 a7 r1 O
: h9 f6 }' a! ]6 Y% B( l' B
if (simple.IsSimulationRunning()) # b- s: `# d( n* C! x' W7 o
WScript.Echo("Simulation is running!"); 2 z2 K! P, x3 M" F7 ^
K4 ]) C. H" a1 |// Wait until simulation is finished
3 c d+ |: c( \) Uwhile (!Finished) WScript.Sleep(2000); , x4 L9 Z: s! [3 U3 a" i
% `: X3 f6 ~, N( Q4 \) I, d
simple.CloseModel();
8 q, E! ^4 A+ W6 jsimple.Quit();
7 t) a( R0 D# J2 `2 i0 KWScript.Quit(); 0 `" |* @) |. d' y
6 L3 e- E% l h0 y- @
; v; P' f4 ^, u7 q3 p6 Cfunction RemoteControl_SimulationFinished() % u" W4 c u# Y/ c% a4 ?7 y
{ / S9 o1 R/ N+ _& q3 @1 }& C
WScript.Echo("Simulation Finished!"); |