Example of a JScript * ]9 n& `6 @' R" ~# d
var vbOKCancel = 1;
4 A: f- B. H, F0 ~- _+ R: rvar vbCancel = 2; . D) j. m( b9 H+ x! `6 C2 e
var vbInformation = 64;
4 d) l, P" G8 T" H; ^+ uvar Finished=false; 9 Q8 i+ g$ N+ i" M: ]
; z1 N3 P; [: N1 [ Z, l* Qvar WSHShell = new ActiveXObject("WScript.Shell"); 6 w. ^; I; J1 E O; ~3 w4 `" t
: M1 z5 o+ }+ Q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , Z& ^2 ]2 z) M+ y5 i7 S
! Q0 C; D; M! y5 Q3 [+ d) qsimple.SetLicenseType("Runtime"); 6 ]' v- t2 V8 y, I
6 z% \5 v, x5 O% l6 _2 s4 s2 F- M
try
5 U* n5 R1 J7 R" Z4 f4 ^{
5 X8 z/ k( M. b- h4 H$ y // Enter the path to a model file! 9 @7 v6 \0 u* V4 U
simple.LoadModel("C:\\Models\\Test.spp");
) ^( `8 |; \, _* s/ ^} 2 r1 e# g5 O1 x! `, u% O% Z
catch (e) ' c; c4 M) [+ M9 h, x; R b
{ ) i5 y7 u9 {. T8 O" u$ |
WScript.Echo("Could not load Model!");
7 [, l6 W1 S7 y% l0 q# `/ T WScript.Quit();
6 H7 Y! z8 t4 [} : ]' V0 y- G- q+ {
/ ^4 [, d' [, O0 }7 m$ G) Utry
% ^8 L4 @0 a2 G5 m+ h' b& p9 r{
9 r. ^( @; `5 ]2 L L simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 x; d& ^2 Q7 h/ M" E+ E r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! z$ S* {. U4 Z
if (r == vbCancel)
6 e% h8 {0 Q" |+ y { * x5 B) d( k9 J7 }# u
simple.CloseModel(); , j Q# n+ N* D9 I p1 s
WScript.Quit();
' n5 g8 B' W1 }7 Y8 L5 L' d }
* s5 m2 V( O1 F3 l}
7 K7 g, K0 \) l& m4 f( w# {' U, u # N7 [! x/ l7 h/ ?
simple.StartSimulation(".Models.Frame.EventController");
' W; B7 |& K, Z2 v( k' \ # e% W$ y3 O9 c' z3 z
if (simple.IsSimulationRunning())
, E# C+ G" v: q! m/ ^1 T# g WScript.Echo("Simulation is running!");
3 [4 E# e% S( t3 E9 k ' b5 U1 r9 B i' U' j* l
// Wait until simulation is finished 7 c- P. x9 U* F7 |" P2 y& ~
while (!Finished) WScript.Sleep(2000); n G# j9 o+ j& s# m
4 @0 q8 i; C: u$ Xsimple.CloseModel(); }+ h( V3 i1 F4 L; z5 |# Z
simple.Quit();
# `, F& z+ |* Z8 oWScript.Quit(); , H7 ]3 Z5 E) p. W
% T6 W h. r1 E5 H3 A 1 Y: R! ]( U0 x4 x% I
function RemoteControl_SimulationFinished()
0 Y7 j! k/ _/ t3 W{
5 m) a# k& E: i) L' P8 r3 s WScript.Echo("Simulation Finished!"); |