Example of a JScript
, H" N" l/ E0 \5 r9 Svar vbOKCancel = 1; . Y: c; c( M, ]
var vbCancel = 2;
! P1 ]+ z h E8 J" Y) ^var vbInformation = 64; ; I: P5 O5 [/ K
var Finished=false; * E a% _7 |3 w" ~5 F
2 P' e( M' T2 o6 n" O
var WSHShell = new ActiveXObject("WScript.Shell");
6 E- Y Y7 e3 Q3 l# e- c+ }
0 ]( [1 O6 D8 O" ^$ fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# A9 P5 J/ V S
. D' o( b2 V) G/ Y2 Ysimple.SetLicenseType("Runtime");
+ ?# ^ Q, c" z3 o& s" C: \5 Z ) J3 E; S4 @" h2 P$ A2 [$ S2 Z
try
4 ^) F3 M% h5 n# w$ l1 l{ ) ?" ]' @, L3 j& S) {" a
// Enter the path to a model file!
4 r/ O5 j& V. Z3 E* G. V simple.LoadModel("C:\\Models\\Test.spp"); 2 v) f0 W. F" f; q
} $ M( C( b' t: k4 b6 M2 }3 i# j
catch (e)
0 P2 i: s) Y; U$ ^3 W{
6 e* r3 w, e( h WScript.Echo("Could not load Model!"); ) u, B6 o# X7 S1 s6 B. f" q) [& u: g
WScript.Quit(); 3 t$ }7 V% F7 u+ [* g
} # C7 Y5 U1 u" T$ g7 n' ^
% a4 o; T7 c* } S" Y) Etry . i0 _, Q5 U6 B
{
7 i: Z3 s: G* e1 }# p8 Y6 {5 x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * f# ]% ?3 h G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 n1 f$ ^' G/ y* J( Y6 h
if (r == vbCancel)
7 v+ G9 N3 S8 L { 3 J Z" V/ Y3 q6 E5 o
simple.CloseModel(); 8 @& s9 o. i+ b3 F: X
WScript.Quit();
0 y+ b, z' w4 y) p }
8 G) R5 F4 c8 @. [# }}
* \! s! ^6 {: S9 b " W, R; ^1 L: `) F8 t9 Y0 U( p
simple.StartSimulation(".Models.Frame.EventController"); ) O0 R* q1 Z$ U5 U
& r: J% r( B7 d! d; C0 y5 ?- X
if (simple.IsSimulationRunning()) ; L8 D( T9 P7 @5 Y
WScript.Echo("Simulation is running!"); * ^) {0 R8 p/ x: X$ l
$ N: W" e$ N6 H% o/ P( c8 Q, h! E
// Wait until simulation is finished
) i% L4 x, K; e" b9 Y4 Vwhile (!Finished) WScript.Sleep(2000);
+ J: g& j$ a% H# Q) C- \" e 6 o% T6 s/ _( |0 g1 @7 q
simple.CloseModel();
) Q& |1 b# A( C7 u+ i7 b1 ~$ Jsimple.Quit();
& }" l+ ]; k8 o* wWScript.Quit();
8 H. o+ E5 `& W" E, ~% f3 @4 Z8 `) t - A0 w( V1 R8 e' |/ _) c5 w# \3 B G
, j4 U9 K; _. G# P( L+ y4 \
function RemoteControl_SimulationFinished()
* t$ Z( \/ }3 i7 f7 L$ H0 b{ 8 X# |: F4 \; ?2 G6 f
WScript.Echo("Simulation Finished!"); |