Example of a JScript
6 o5 `, A/ J F! }) ^- V1 d. {var vbOKCancel = 1;
/ J7 P5 E5 l5 R1 H+ A3 t+ wvar vbCancel = 2;
1 u- l' M5 U2 C7 ovar vbInformation = 64;
" n7 i8 q5 `/ s& H1 q' M& ~var Finished=false;
+ M/ E" p4 ]1 o6 y1 l; N: L
4 t' F- g( N6 I' Ovar WSHShell = new ActiveXObject("WScript.Shell"); 1 w4 e! T" `$ Y2 Y7 x2 V7 s; g( t
" u& `, m! K5 z- Q& e& pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 K) w" i' g5 y" W8 x- e
+ y) Y3 \2 X- q1 T" G; Osimple.SetLicenseType("Runtime");
& k, ?( b: w3 t0 B, o4 V. ?) ^ : n1 Q9 Y h- ]! L
try
( N( p( j$ @3 k) d) Y{
+ z- @( m: Q/ n& c // Enter the path to a model file!
+ {. z, o5 [, w9 h v2 a; a simple.LoadModel("C:\\Models\\Test.spp");
; ]- m2 b% B, L2 w9 V2 M9 s} - z4 D* {1 R7 b0 m
catch (e) ' K7 \7 w" {# }2 m- e) Q- }
{ # d- ?) g h$ O6 u/ {
WScript.Echo("Could not load Model!");
( O# K5 b" g: y WScript.Quit();
5 i5 W4 C' T/ ]! @} , V5 F; T, ^% o$ h& x. {
5 O) m/ K* T" t8 vtry 1 u; |! Y4 O( @% P
{ : `' c, ], d: x" ^' e. n: J. |
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 @9 m$ W9 ^; K' ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & l* z# S, M8 c# @; d: p
if (r == vbCancel) * z. O' H P8 h0 C: ^4 h7 E
{
" c) |* T6 w# U simple.CloseModel();
2 c* k1 [0 u" }! q% S# ]+ t WScript.Quit(); : O# H/ [( }9 ?# A. h! m* E
}
, b! p' M7 X f} 4 C e/ M/ D. j
7 @7 t1 t; @, T) l- fsimple.StartSimulation(".Models.Frame.EventController");
. m- h! C/ J+ z& q ( u y$ {. `/ R
if (simple.IsSimulationRunning()) 1 ]6 A" a2 `# E6 ~. z8 ]! L
WScript.Echo("Simulation is running!"); + {& z5 W3 I% W0 u4 h) E) ^
$ ^ J$ A3 Q& D; _8 g! h9 L( t% K; d// Wait until simulation is finished 8 m: @3 b: q2 h% X0 d% c( K' K
while (!Finished) WScript.Sleep(2000);
& l N) E; S9 O% N
7 Y X# ? h' X2 O! K5 x* qsimple.CloseModel(); " ^4 `) g# o/ I( q5 ]
simple.Quit(); * x; i# e* A: e6 x8 X, V
WScript.Quit();
, \" t8 P+ }7 Q
8 A5 x( u+ A2 ] f# M. R( N
( A6 P. o, O O- }function RemoteControl_SimulationFinished()
3 z7 m6 A+ F" d! p{
( p0 B" c- |/ [6 I; V7 w WScript.Echo("Simulation Finished!"); |