Example of a JScript
. L5 g# U8 L% K3 w/ a, @2 h, Ovar vbOKCancel = 1; % N: V" q) e# f& r5 H5 b+ y
var vbCancel = 2; 2 w1 x8 o" J# L/ Q" q/ I2 V. D+ ?2 @9 C9 C
var vbInformation = 64; ! b, B+ a% ?# `5 g
var Finished=false;
" A: f" f$ h0 ~# o* t9 v * I% l- }# R, `5 V4 v" i1 L
var WSHShell = new ActiveXObject("WScript.Shell"); 0 P0 Q& R' d; w2 B1 s
& Q$ w( ?7 h3 y# b4 A8 @9 g9 w. `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 f, e; ^. V- n% a
) e# M9 `, @3 n5 k( osimple.SetLicenseType("Runtime");
$ d) {! _) ?4 x2 \ s4 r3 Q
" T5 g; v6 n' o; H3 Z8 e Atry
$ J7 |) H$ e0 \0 {( z3 l{ ( B* C+ \. j( S
// Enter the path to a model file! $ \8 g) A; V6 e
simple.LoadModel("C:\\Models\\Test.spp");
& b/ f, i$ ?$ H5 V7 e! }} 0 y5 P7 A7 |- a& u3 {, s0 H8 s; u
catch (e)
' e/ C F3 }' ?6 y4 E{ / T" B: D! C0 z& `# I
WScript.Echo("Could not load Model!"); % A5 I+ z! U6 Q- h# @/ i
WScript.Quit(); ) j2 j/ u) X8 X: ^( ~6 C
} ; c, l3 M: P' S+ u
) P+ }* Q) `* e* p4 i! B0 f0 ?try
! J% ?+ b8 ? K0 i{ 9 @+ F* h1 X" @ @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ c4 u: Z5 P% R1 [' p0 x r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ B1 e# B& W( [9 Z2 b, U
if (r == vbCancel)
0 M V0 h, @+ h/ a {
, W8 |0 k7 v! j5 z- F8 K simple.CloseModel();
& q. D; Q5 l' O' H$ K$ Q* ? WScript.Quit(); 2 L; S$ M1 V) [" a! j/ U' b
}
6 ]* R. Q: E5 G} + p# q7 ~; B" \5 L# @0 M
* s* i% I8 ~$ W2 u& h
simple.StartSimulation(".Models.Frame.EventController");
9 P6 K; a# ~- z6 k% k: q
- q3 X' ~8 I9 q: s. Mif (simple.IsSimulationRunning()) : R7 d4 R% r$ Z7 A/ o+ E
WScript.Echo("Simulation is running!");
# C: Q9 O( J6 U- n $ ]6 x4 Z! Q0 G' F
// Wait until simulation is finished . Y7 q2 e6 v: a( m/ T9 U- H
while (!Finished) WScript.Sleep(2000); ; `2 T5 @# W$ \* i, M: ~& q% C' c
3 p' `7 n- N( S5 P. I! r: Psimple.CloseModel();
/ l9 E/ s3 ~% n0 Y& ~% M* E0 @simple.Quit(); ; r: B; W6 p {$ u, S! j
WScript.Quit();
$ Y$ i% F6 a$ F% Q5 r $ g- Y% S9 @% u
0 l8 F6 m/ B- N# k( Z" |8 |% _
function RemoteControl_SimulationFinished()
6 }3 [: O! C3 }- w+ C" |6 b& o{ 9 }& k3 I, Z% ~$ b4 \2 ^/ H1 |6 Q( Q
WScript.Echo("Simulation Finished!"); |