Example of a JScript
+ V( l W. H# P2 Y- avar vbOKCancel = 1; $ _! Y+ J3 n7 z6 Y' F
var vbCancel = 2;
% d H1 E/ y6 H8 a! pvar vbInformation = 64; : V7 o' ?" s- l
var Finished=false;
|! Y- q' E; j 2 p, n9 i' ?. o8 z* b' X& i
var WSHShell = new ActiveXObject("WScript.Shell");
+ E4 D/ t; n% l& k" } 5 r$ i. d# m$ d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 |! h- D4 T1 a' m0 w+ {( ]
1 m" g$ b' U5 o8 \( G
simple.SetLicenseType("Runtime"); ! K C1 ~) k: E) Y
' l* X: l9 a( q! a9 P0 Etry & s4 c+ a' z3 p* D, u6 Q
{
2 T7 b3 ?+ Z$ w# J9 N // Enter the path to a model file! 4 ]0 ?9 [# P% u3 m
simple.LoadModel("C:\\Models\\Test.spp"); / Y+ m, v7 b! Y5 y; D# a/ E; A+ a& n
}
0 z, `% [. G0 a% A1 j0 Y) U/ ucatch (e)
$ }0 u+ \" \1 B# ^" ^{
) V# y, n* M- Z4 T WScript.Echo("Could not load Model!");
7 J: [4 d- H) L# R WScript.Quit(); 2 V: Y/ T& H. O: Q
} 0 g$ [! W, J% m5 q! d
/ ]6 i. |' d6 jtry
, R9 _5 P3 D- T7 g/ B6 ~9 r6 y{ 9 T' D, l7 Y) ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( H: ], ?. v( c ]/ [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " r% a, e: C, A- `
if (r == vbCancel) % @; Y* l8 G% p& v+ ^2 g8 g
{
) ~5 r0 ~, b) T- C simple.CloseModel();
l- Z# v1 Z/ W( [3 I! ? WScript.Quit(); + ^$ e* }" z& I# ^& x
} ' Z% O. r. s7 X* i5 ^
}
; i9 s; @) A* ~6 D8 _ " t; S7 H) F8 H) w8 R
simple.StartSimulation(".Models.Frame.EventController"); 0 G; f" W+ t1 @, b9 F9 W4 w. X3 M
9 ~) _1 Y2 D O. |: Y2 Z8 ?. n
if (simple.IsSimulationRunning()) " Y9 N+ z; d- P8 B. g( a, t/ Q. S
WScript.Echo("Simulation is running!");
: t7 l9 G. a! Y, l7 F+ m
. A* T. b5 x8 @// Wait until simulation is finished
) j8 i# F: {: X# |while (!Finished) WScript.Sleep(2000);
^' t4 M. T5 c& d0 G, j/ ] ; d' z. V$ E" N$ R
simple.CloseModel(); 6 B4 ]" {7 _, W
simple.Quit(); / X( P( [- b' ?4 G. C# \. l
WScript.Quit();
0 @2 u2 A9 [' c3 p% w+ \ * R- Z9 a8 a Q( C! r5 X
+ C! `! E" |" Z' |& x$ X
function RemoteControl_SimulationFinished()
7 d/ K, B8 f. S& y( T7 I1 Z{
& g6 `) A0 f2 H* a9 J( x WScript.Echo("Simulation Finished!"); |