Example of a JScript 0 P% c, }& `; l7 Y& Y% i
var vbOKCancel = 1;
. u. I" J+ R1 |1 ?9 W6 w; svar vbCancel = 2;
4 K/ n1 [1 m1 R# T. V8 h' A% jvar vbInformation = 64; 2 g7 a c5 [4 F: {8 Z* Z* A; S
var Finished=false; 8 t7 Q8 M* Q( c( h8 Z& k' U
, U6 Y3 v4 l% _) Cvar WSHShell = new ActiveXObject("WScript.Shell");
6 ?) e, M/ m/ P" u6 P5 e: ^: c: v
6 q% l+ I0 p( `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : x# _0 l7 j e
) s5 x! X5 [. E: U' `* C' nsimple.SetLicenseType("Runtime"); ; y& ~% E+ b" }! J. D
7 {* u# {; Z! |& ]" gtry
' u. w. j& t0 h5 G{ ! F3 k7 w' F& m% z6 T9 B2 B
// Enter the path to a model file!
+ h, S c }& y3 s7 _8 \ t simple.LoadModel("C:\\Models\\Test.spp");
- {- h8 ^! p. j# r( Z}
" p1 P! i3 w% o) J8 Tcatch (e) 6 y! m& _3 o ^
{
1 x# ` J; z* ~3 u0 L p( O! m WScript.Echo("Could not load Model!"); 7 h( V7 z# N$ s6 U. J3 k
WScript.Quit();
+ f5 f/ c: l$ O}
r4 z5 L8 r e% i2 ~
4 Q \( C( x+ R, f1 Gtry
6 H# A" s1 j" b/ z{
! ]8 C% l$ D' ` b$ u- d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ p1 E8 ?9 W$ ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ r, T1 q2 n& l7 I: k4 _, U. Q if (r == vbCancel)
6 T2 E6 \0 B* ?* u1 k& D1 c7 V; k { 2 D/ P* q) y+ d6 R
simple.CloseModel();
. B) ~- h' [( `% E" w/ L WScript.Quit();
/ _3 j# Q4 c( B% R5 g }
! s& E9 W, C7 q& W2 C$ Z}
1 A G7 [3 U4 F4 X; }5 t
$ P6 l) r* k8 b' n2 U6 Ysimple.StartSimulation(".Models.Frame.EventController");
2 E# O6 V# `7 w5 K% \) S2 ?6 o ) M# W9 D! U' f9 x$ w
if (simple.IsSimulationRunning()) , h( Q2 n/ u+ q0 A9 J- E
WScript.Echo("Simulation is running!"); 9 M2 K2 A% H1 b- m
, V: k; D* |# \3 m$ D
// Wait until simulation is finished 1 x1 p1 _6 p7 ^7 @! q
while (!Finished) WScript.Sleep(2000); & ?* U' B" D f- l8 l8 x" z/ N
/ `4 n; ?2 V# w; K' Y csimple.CloseModel();
/ p! j. Z" P2 lsimple.Quit();
. v8 D' ^# [/ _WScript.Quit();
/ D& c' l+ y9 K$ y& f: e
/ c5 @4 S7 s5 e2 R* h$ j! W: }
" o+ q+ }5 L2 p8 ufunction RemoteControl_SimulationFinished()
/ |: Z* C/ e+ u. Z9 C2 r+ |' w) d{
$ k; K( M' Z2 q7 u, s WScript.Echo("Simulation Finished!"); |