Example of a JScript 9 @, {1 m: d/ q+ f
var vbOKCancel = 1; ; M6 }* `+ ?7 H. x$ ^0 @
var vbCancel = 2; x/ ]9 g- |" o! g1 q, Y8 ~9 _
var vbInformation = 64;
( R: ]! |, r1 S) |$ l/ [var Finished=false; 4 K; }8 ?$ F @) R
P* e8 V7 \/ Q5 y0 }var WSHShell = new ActiveXObject("WScript.Shell"); + n% F; o! O/ X& ^/ q0 J3 O
: e1 k3 H# d6 X# V7 Fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 n. C2 C4 @: m* M
3 u5 A3 \1 x" r: A7 O8 E
simple.SetLicenseType("Runtime"); : y9 i t5 V( w3 |1 }2 G
r) H0 l; H$ h$ ^try 9 ]& I+ w% R3 }
{
7 A* M& |: y4 `! @ j% A // Enter the path to a model file!
5 g7 I [0 j8 W3 B6 l4 Z simple.LoadModel("C:\\Models\\Test.spp");
3 b! u r" U9 E5 \) }- {} " |, ~; _. [) o0 ^
catch (e) 6 X% s0 X3 Z6 M4 O
{ ! b" I3 i" @1 P
WScript.Echo("Could not load Model!");
$ ~4 r# h" l9 I/ e6 u WScript.Quit();
% [6 ?. s4 x3 u, F- X4 w; L0 Y} 6 W7 ^* `- g- ^6 O- \
2 M- e( Z! O( h" ytry
- j) ~& S: y9 L) v4 p{
+ l+ K" L0 e6 ~1 @+ R7 c% P* t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " r# Q0 ~9 L' l( E0 f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 U+ |. o# P) D( p) a7 V+ \
if (r == vbCancel)
- z5 f% Z* r# x3 ` {
& U8 f- q' h/ j& k2 k- K6 b5 D% C simple.CloseModel();
9 A6 A9 d- o; ^7 d$ j8 _) d WScript.Quit();
0 J% U! d! S+ A- @; f } 3 e. t% v5 J* B: n b" T! ]0 l# D
}
* ~ Y+ L9 w1 w d/ b, q% Q. o! V& a% j
6 Q& f/ [2 T% Q8 G7 ~, ^* X8 Zsimple.StartSimulation(".Models.Frame.EventController"); C* {5 L$ z0 J/ g7 y! J0 F1 R. F" ]
6 S% ~; `' i1 b3 p* k
if (simple.IsSimulationRunning())
, |8 N. j# A! c+ u Q, ~ WScript.Echo("Simulation is running!");
9 B0 A4 I8 ?4 K 8 A- f' h# X& a$ \
// Wait until simulation is finished
- U- |0 w* r7 D* Fwhile (!Finished) WScript.Sleep(2000);
6 H2 o% u* o3 f' S5 t6 t
. d' v( I& O+ e. _8 g- ysimple.CloseModel(); 8 B% G& x# c) R, ~- u
simple.Quit();
% E$ t! c" m$ V+ B0 P$ z6 C. eWScript.Quit(); - E: ^7 c# Q% q# I" J
. C( w! v- q4 j/ H. m
$ h" K% H4 m7 a: Nfunction RemoteControl_SimulationFinished()
: e9 l! v% M4 O6 q* ?( A% L. L" l{ $ m6 M( J3 H1 N0 ]
WScript.Echo("Simulation Finished!"); |