Example of a JScript
; N$ Q* }+ Q& z, svar vbOKCancel = 1; ! I. N* o1 d/ @
var vbCancel = 2; + D2 G$ T1 t5 a1 Y8 w1 u
var vbInformation = 64;
0 P9 |( v! d: f3 m- hvar Finished=false; / z+ w. k# A' s: G
* o/ }7 p/ Q% |, L4 X( Y7 o
var WSHShell = new ActiveXObject("WScript.Shell"); & f$ m+ c( h4 H% x! ^% i
# d* S) R$ E2 ^1 D9 Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); |+ w' n$ r! Y) p+ S# C; Z* |" t/ e
* ]$ V9 \3 r; Y- a6 {$ @simple.SetLicenseType("Runtime"); 9 m0 W, {5 E7 a! p' L. `+ Q8 J. W
( b1 |; Q) f1 w" {0 @
try 2 N: G Z$ D9 c
{
% k# d* [: M! ~ // Enter the path to a model file! ' K' Y9 n4 x5 I$ Y2 `& R* \
simple.LoadModel("C:\\Models\\Test.spp");
3 _: U% `; C0 _3 s2 R) M}
{! _( l! s, @" b- Kcatch (e) % S; D% g* R" O/ z* @
{ ' z1 m$ d" z# a3 u
WScript.Echo("Could not load Model!");
2 | q3 C& g- T! J WScript.Quit(); " {* e0 E8 Y1 Y. I5 G8 |% d
} 4 S) G, s) |- L7 q- v- C) h
' @% _0 C6 ^/ f" r; Wtry
+ j6 z* E. G$ N g, \; O# B" O7 k# V{ $ T0 d) t$ L' G3 F$ Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: a+ W& P2 W+ r/ Y& |6 Z4 R r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 j G/ O2 w2 D3 f w M* V
if (r == vbCancel) . s2 t) N9 U! D" \/ H- \8 u
{ - P2 u- A4 |$ j$ p/ R7 T
simple.CloseModel();
" c8 L# e6 @4 m5 v) q' r WScript.Quit(); ; _) O2 `- y, o7 k- h% S' a
} " |3 H/ k- O2 B- |) q0 o
} ) }# t# R t6 F: _
H0 y* H& O. j" gsimple.StartSimulation(".Models.Frame.EventController"); 6 p! y' h3 [+ f. O
5 B. N2 V8 T) c) }) }: p( p' F: Fif (simple.IsSimulationRunning())
) W6 }" _! t! {4 k5 ~+ {# Q1 C WScript.Echo("Simulation is running!");
) t6 v6 V9 V7 V3 r& t
, p2 D: T% d! B// Wait until simulation is finished
# T2 \) O$ C5 H' ^1 _ @$ \while (!Finished) WScript.Sleep(2000); ! _2 z6 f+ } A6 m. `- @- C& y
& v" Y; h% z1 o% D1 c+ O) r" dsimple.CloseModel(); 5 l# `$ H0 F: Y, m
simple.Quit(); * _# |" s& T9 j3 A1 g
WScript.Quit(); : n" U3 d* i, c
( J- B' o7 y% X9 w7 B
' e/ V$ @3 u5 S$ M2 [function RemoteControl_SimulationFinished() [3 R3 q/ K: |! P- r0 n$ d: i
{
) f7 |% g0 W( d% s# `. m; g WScript.Echo("Simulation Finished!"); |