Example of a JScript & b) L# n2 g) q4 V! n8 w
var vbOKCancel = 1;
& L+ D1 n8 a# g" ^4 {) ~var vbCancel = 2;
- |! @5 w( g6 U3 i& b- b( yvar vbInformation = 64; 8 [# w* w5 ^% L
var Finished=false; # X& x5 @) R- K- O6 E0 o
" I3 Y s: J+ ~2 wvar WSHShell = new ActiveXObject("WScript.Shell");
2 y. P, E) V- G: v& l
6 f6 m8 _3 t" Zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 n" L0 B; C% p: b9 K
7 g. n3 n% H" C5 Y; Usimple.SetLicenseType("Runtime");
3 _( V" l( T* b/ q% R
1 P: {" m/ \. p ?try
, m o5 w. N6 z8 J9 n y2 z b{ 5 W+ m+ H* E+ a
// Enter the path to a model file! 3 B9 Y7 ?6 `1 H8 w' t6 I- ~
simple.LoadModel("C:\\Models\\Test.spp");
$ }- z; k1 c( c/ Q}
0 _, k9 b, y* |catch (e) ( F6 M5 `8 ?4 l0 T% d+ }( d- x
{
% I$ c. `7 c$ J/ H3 ~' Y WScript.Echo("Could not load Model!"); ! X, V; a+ y1 V( y2 r8 L
WScript.Quit(); 6 K& Y. z5 l# m- S }4 n
} 7 U V* k2 O0 Q/ h- u F
$ P4 M9 }7 Z1 s! Q$ w
try
/ Q+ G( W1 p* e{ : \. Y* U, C+ ?. Z& R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 H& q- D5 ]4 A
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* U" g" V! p* f5 b7 l if (r == vbCancel) + y% @( Z7 E# |' t
{ ( G* L* r8 g; f: L6 o* N
simple.CloseModel();
% q d4 J. @. N8 e) I WScript.Quit(); - E" m+ A; F' U; d7 _& d3 }8 y
}
_& \& Y. W$ v' @: x( F}
; R; b$ n1 G* J8 U' m) \! L( K7 P 9 P i% A: `2 f' m: c# Q- _0 H
simple.StartSimulation(".Models.Frame.EventController");
2 f1 t% G" g9 |" [9 R/ [/ a * |. M# j# ^/ }6 z
if (simple.IsSimulationRunning())
3 ]- f5 J0 P0 D2 M% H6 x# u% E3 _ WScript.Echo("Simulation is running!");
. K2 N' ?, s E9 x
. i8 c% T$ a' P& Z// Wait until simulation is finished
9 s: W3 q0 L7 g0 J1 T. [0 P7 Twhile (!Finished) WScript.Sleep(2000);
0 u. K# H/ ]& {: f% j 4 A8 d6 I( g$ b2 u# b
simple.CloseModel(); 0 m! C, p# Z d' [8 C
simple.Quit();
* D5 Q4 s! n2 w% rWScript.Quit();
0 N# Y& }% Z( t% w/ V" R. C4 Z! h
/ A$ v7 b; a; C6 a0 c
0 G$ G# i/ v# d8 X, V; jfunction RemoteControl_SimulationFinished()
9 o. l; S# U6 W{ - I$ A4 p- d2 K; Q1 a: }
WScript.Echo("Simulation Finished!"); |