Example of a JScript
X8 A$ [; S" E: t2 ivar vbOKCancel = 1;
6 W w! L B6 }4 e c+ xvar vbCancel = 2; % a b3 `- D# K) p* w
var vbInformation = 64;
# a/ @. ]7 O5 v' D0 fvar Finished=false;
3 M0 P9 a: k6 G1 U& y5 e
" o) z2 e! H1 Z+ U' Y6 c- @var WSHShell = new ActiveXObject("WScript.Shell"); $ C ]! a1 d- e0 d2 L
, m$ L$ @( ~5 b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; G$ N9 H" g) |0 u3 z" n, W
9 w; j5 ]; R: ^simple.SetLicenseType("Runtime"); ' Z% `# q) k3 N: l
" }' B1 A) a4 d# V
try
# R8 {9 B0 L1 L/ _# P3 Q) J- [; Y{
4 X/ q4 v' P! Q5 ?' }1 c* A; u // Enter the path to a model file! 1 t3 y5 z# c$ p3 M
simple.LoadModel("C:\\Models\\Test.spp"); - N$ }2 b, b) V7 Q5 g# P7 Q2 f
} 2 B: `& l$ B) |1 U% F) _7 k& t" L& m
catch (e)
, }6 ?% c J6 A6 V/ P, L{ - \! T8 G* J5 p& k8 |+ B2 K
WScript.Echo("Could not load Model!"); " u5 F3 v- j# V
WScript.Quit(); 2 Y/ ~+ P) s6 N- \9 R5 [9 s2 F
}
% g1 P$ \; j6 X8 A8 ?# B/ ~ 9 i" p- |1 I8 d8 z3 k5 {9 d( e# W
try
7 {8 u6 u, N4 _( {{
9 c! H3 K- s, B% U6 z% }4 m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ L) k3 J. s- Y3 a; @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( e3 r V* c7 v0 v, x6 N9 }% {2 A if (r == vbCancel)
- _9 f: I K; C0 T5 X3 M { 0 w; N6 p6 h5 w: A
simple.CloseModel();
+ q, {* U1 C0 T1 v WScript.Quit();
* ?4 Z* s1 q* c3 q# Q0 m }
) i8 _2 M$ @1 |0 V} D" E/ q7 k, s! e+ F# e: ~
$ W: i6 ~% e, `# Psimple.StartSimulation(".Models.Frame.EventController");
, J! `, @* I' S+ U) j1 C- r $ H' `- _% v2 U1 L8 U
if (simple.IsSimulationRunning())
& `! C, a: I7 j" D WScript.Echo("Simulation is running!"); 9 Q6 G8 M2 Z% i- \( I; ]
( d7 Z6 d7 O4 S; G2 x// Wait until simulation is finished ' E, ^/ S4 Y- F* n% U" O. W8 Q
while (!Finished) WScript.Sleep(2000);
' d5 P6 r5 u0 q- C8 d' f' z
5 }! P! }4 O/ W! A; V: ~simple.CloseModel();
$ l) r4 j8 r3 o4 ^5 Q: Esimple.Quit(); ) G2 d0 ^ w+ A7 `
WScript.Quit();
- t) J( P' j+ D6 h% Z" S9 }
+ X% u, h% p! [, b3 ~/ M
; H, W# }- v7 vfunction RemoteControl_SimulationFinished()
1 p$ @$ ?. L5 o( ^2 L* M% S8 \{ - P3 V6 F- g" i4 c6 p* o! v! o
WScript.Echo("Simulation Finished!"); |