Example of a JScript
* |! C, M1 V; g9 F5 j9 |1 a0 Jvar vbOKCancel = 1; [ V6 N- ?7 ?9 n
var vbCancel = 2;
# a# _5 z8 |' Fvar vbInformation = 64;
; ~9 z/ A! \5 E; T( {var Finished=false;
4 y$ i- L6 z6 t# S
9 R0 s( U' Q7 T+ x# v9 mvar WSHShell = new ActiveXObject("WScript.Shell"); % {0 h" b1 A# G0 |2 d5 p) Y
7 U/ _+ J" ^! Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 _; P* w6 o# |4 d& l- `
3 `6 T! @7 A/ C7 r( x$ k/ Q5 ^' H
simple.SetLicenseType("Runtime"); $ m7 w* x% z, s7 B1 o
" M: a; ?! z2 i9 [! o, Utry
9 D6 b l- s8 _7 n2 a{ ; k+ ?4 l" q+ G0 u
// Enter the path to a model file!
$ \/ X8 e \- w: d7 s4 e. y simple.LoadModel("C:\\Models\\Test.spp");
, j, s& }4 l7 R- G. b/ g) c# O}
' a+ g6 x! K# bcatch (e) J3 B& g, q( Y0 f( s: a- ?& V' ?! a
{ 8 p/ g* h# ~/ `( q& L9 y
WScript.Echo("Could not load Model!");
2 n, ^- M A/ W! e' w WScript.Quit(); # C; T/ {7 m( O9 ]$ h
}
% O* c: S: k, B& [5 |; v1 N 8 z Q) I1 t/ h: p3 N) T
try
9 n6 D6 u& L* T" ]2 u+ O2 W{
3 i% C2 T6 q' d F3 P5 q1 |* `/ U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! O, e- G" D. P; d! A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 J- l8 Q U1 H3 ~/ p* I if (r == vbCancel)
9 p: V/ z1 P u {
- {1 V) L- c5 Z- I: ? simple.CloseModel(); ! d6 ]$ C. ~ r3 {+ n# T
WScript.Quit();
c; a. Q. Q! D1 M } 7 ^+ q) n- \/ W5 r% }: ]
}
; |7 Q E8 \ ~: X# R# h
$ h8 O! _, O: [) z& ^4 Xsimple.StartSimulation(".Models.Frame.EventController");
6 o6 `2 G6 ?# F* t7 s " K& O: o9 b! @% s7 w( N) T
if (simple.IsSimulationRunning())
8 t/ U H3 I; V9 \' A7 z% s7 ^ WScript.Echo("Simulation is running!");
' ]# P9 f+ A M, p
0 N; r7 p+ _6 p/ R( q) `: m// Wait until simulation is finished ; o# c- e% ~. D" x& }8 w& }9 U
while (!Finished) WScript.Sleep(2000);
* Q) l" J1 C6 K/ m3 t" `7 q' J- m / Y$ X9 X9 \* c' z4 I
simple.CloseModel(); ' v. |5 \; U5 \+ b0 g: W
simple.Quit(); % s N: P' j7 o6 w. W& j
WScript.Quit();
7 O7 t$ w! P& Z0 l5 l
/ ^: o2 {. V5 s, i1 [
& V. g6 O+ C! d" ]0 \function RemoteControl_SimulationFinished() , q; }# `9 t" J3 A
{ . U9 B) [& m" \7 |: O
WScript.Echo("Simulation Finished!"); |