Example of a JScript
9 K0 C6 H/ d2 K+ X& W0 _: Mvar vbOKCancel = 1;
3 ~; v9 v# f! K4 \: z6 Fvar vbCancel = 2; . f( s- K6 i! Y( y" H9 P
var vbInformation = 64;
5 ?& Y" S6 B2 F, Rvar Finished=false;
c/ h. s, y% E: G! _8 B% j
/ Q5 E: c+ t9 y7 k: Lvar WSHShell = new ActiveXObject("WScript.Shell"); 0 t* C$ ~0 E% l+ F8 a" O9 [, E# L
8 l, p, O6 \; g. ~. O: e& |
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ [. Z! q9 K# h' I7 x; q! \/ r
+ q4 l' S+ y& b: `9 x
simple.SetLicenseType("Runtime"); 8 Q5 n# w" t' R$ A: M' ] l0 y
; N$ ?9 _6 g5 _! n2 s
try 8 G8 Y, b2 _; W! }4 F4 {' j
{ |) L/ V2 j: e; G5 b
// Enter the path to a model file! / L! P/ [; O* e# K. \. R- x1 A
simple.LoadModel("C:\\Models\\Test.spp");
# m& M- j, Q$ @' v4 B} 0 u9 Z6 n6 h9 ^. t
catch (e)
; C2 L. r7 |; d% _, l3 ]& X! M{ 4 {1 R( i9 o. Y$ i( T: u% @
WScript.Echo("Could not load Model!");
: Q" |/ g$ Y( b7 y, h WScript.Quit();
A1 T, A; X8 h$ l} ! |! P3 F" N$ F9 G5 @/ d T8 X# S
9 G8 e5 u+ s# o/ q0 x6 Y
try 3 S2 s$ u! Q1 w6 I# d0 ~( f, o
{ & D0 ~( Z# b9 G: u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
q+ X5 f+ P5 v) ^; Q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# B7 D$ {0 o# Y& n2 Y- G0 `1 }4 H1 D if (r == vbCancel) , w2 p5 T; f' {
{
" q$ Z% ]7 D) ]) H, z- f simple.CloseModel();
- i8 t8 `0 K6 Y- { I WScript.Quit();
* j1 u% T$ |7 D5 a/ g }
" M1 w! l1 f7 @8 ?' N, s# l}
% m* C( g! ^$ S/ n5 s7 E$ }7 p
. p( A; u' C; r9 S. E3 P6 Osimple.StartSimulation(".Models.Frame.EventController");
# v1 e$ O. U% J5 S& s
' N% _2 H8 a8 V3 }if (simple.IsSimulationRunning()) C) k7 R% c' ^: A( @
WScript.Echo("Simulation is running!");
; P/ E. b% B1 l/ z/ w4 ]
# s/ W7 x2 A2 m" v( S+ M1 {// Wait until simulation is finished
) w7 @+ K( |& t! C2 ?* N7 ^1 \$ Owhile (!Finished) WScript.Sleep(2000);
5 ]! |, \# c1 A
1 P2 i) h% M% L2 K4 h( Qsimple.CloseModel(); 2 r. y n- x$ Q5 A0 _
simple.Quit();
7 F# H% m. y" U& ]WScript.Quit();
0 w6 q R l' \0 T- w* ~+ o4 | 2 l% Z/ ? L/ \" R
/ Y4 E% M4 M- t% p
function RemoteControl_SimulationFinished() 4 Z; F. @7 V, M/ f
{ & x7 w: p7 f. p; F* L" w5 i
WScript.Echo("Simulation Finished!"); |