Example of a JScript
/ o4 L# _; t. F9 O% o9 y0 ~% W3 J( o" xvar vbOKCancel = 1;
7 \- ~: }- e% \- d( Svar vbCancel = 2;
4 q' ?6 n7 v+ |: pvar vbInformation = 64;
3 r' D; V2 W! a/ `) J5 T- fvar Finished=false; + y" Z+ n3 z" G K
% K* e" E3 j8 C' ?9 Ivar WSHShell = new ActiveXObject("WScript.Shell");
) @, M$ m; G* H6 X1 Y8 Z
' A% [' c9 c) R4 v+ uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - |4 [* s3 _/ E5 R5 M
- y+ |3 E( T6 W5 h: ^/ Usimple.SetLicenseType("Runtime");
; p1 {+ q" X6 G0 ]+ |' [
! N. X. e n0 _1 C0 xtry 7 X I7 s& O% q; @" Q
{ 3 O8 h7 Q* ~5 w9 @7 k. ^0 o6 o5 r
// Enter the path to a model file!
& e, [: `5 P* Y9 v7 t$ ^" z simple.LoadModel("C:\\Models\\Test.spp"); * O/ r% P2 m' t9 Q/ R8 x
} 5 ]' _& L9 z9 Y2 S
catch (e)
, |) D4 x) w5 P0 ?3 n) ]4 W. v" p{ & \. r! K' n! m
WScript.Echo("Could not load Model!"); ' y, ^# T) {. z* y: H* b9 Z
WScript.Quit(); 0 M- F* g! O1 n0 E1 L: [! {. A
} 5 w3 m: t, {4 F8 I
5 @$ S V) U' d, K! D9 }6 S" otry & e( l! T6 Z8 S1 b8 m. M4 x
{ . F" z! O& ]1 C8 X) s* k2 y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * W S' \. y* H: k! Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / O- W! o9 [+ h7 }
if (r == vbCancel)
% x6 N* v$ u1 m% k G( l+ ? { ; F: Y0 S- {- W6 b8 d D$ d
simple.CloseModel(); : l- A' ]; ?- t7 L/ X- n9 I
WScript.Quit();
9 A' @$ L0 r) u% M } ! A; o; m/ L( l Z$ g- x
} I$ \9 A0 P5 P& y% ~2 ~0 n2 G5 c
* E, u- G! Q3 k3 A6 m
simple.StartSimulation(".Models.Frame.EventController");
: r9 A. X' c B6 C
# H6 U) B8 g7 c% _if (simple.IsSimulationRunning()) * a! K' z4 P3 Y# Q+ d- N
WScript.Echo("Simulation is running!");
( [* m) f' R7 a" ?
; O) H+ r% g: F7 D4 T. g7 X( u, S0 x5 u// Wait until simulation is finished ( `" V3 q4 S, ~/ k; K, }
while (!Finished) WScript.Sleep(2000); : n! h2 I. J& F& i& @
2 T J: J! B+ j! q1 ~
simple.CloseModel(); 7 N7 C( L5 Q. T* M X
simple.Quit();
2 M, S( _* m! z# l. aWScript.Quit(); ! n, e% g3 p; f$ {% f
- L/ _0 N- x; ~! M7 J1 D + Y) `9 _# C% X5 m6 E1 z
function RemoteControl_SimulationFinished() * F; u; H$ x1 B3 x
{ 7 m$ y+ X( Y+ ?, y8 L( ^9 u! [. T2 X+ b
WScript.Echo("Simulation Finished!"); |