Example of a JScript * {/ L0 i" h2 g9 q
var vbOKCancel = 1;
: y6 g! _$ d2 b& Q2 e0 u4 Fvar vbCancel = 2;
0 i7 _. |2 I" t, i& `# gvar vbInformation = 64; & j# b1 |# p. K' E4 l! G. T
var Finished=false; , s! P+ {! C8 |/ Q: t- ]* C
- N% C. J8 h! e; y6 G$ d* M6 y
var WSHShell = new ActiveXObject("WScript.Shell");
) a" |: P! i# }! W: \) ?' h, F # E4 Q/ g& V) }- ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ u) x0 i! J$ H% O+ k- a! g. f% y 8 {. }" ?/ _' _$ n
simple.SetLicenseType("Runtime");
2 ]4 ^& W* {# H _6 b
( P5 Z, M. _' a# qtry & ]/ ?# O1 g- m
{
( b) }5 ?" a) R. c6 L8 a // Enter the path to a model file!
+ `3 Y/ h! k5 p9 C8 p3 o4 ] simple.LoadModel("C:\\Models\\Test.spp");
% ?+ ?# d4 G9 W4 v# V} 4 e$ k0 E7 X a9 p$ K) Q' f/ B: x; Q
catch (e)
' `9 d6 Y5 R5 C! G" d{ $ |' N0 @& b& F' s
WScript.Echo("Could not load Model!"); 7 J6 ?8 O- k1 E2 x) v* ]
WScript.Quit();
& [" [0 U5 ?4 N+ Z) |1 o- C} 7 D) D* k: d% r4 `3 x3 D. y7 i9 p
$ l( r; n% K( _/ ]) F* Wtry
4 M+ c. b( O P& Z- A1 E8 B{ 6 Q% K$ i$ p3 W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# q& l4 ~. [) {8 J& h r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& H; @$ E) L$ p5 t: E if (r == vbCancel) * a; x* T" h. }- @ A5 ~# K
{ ) o0 c3 d+ w' H1 \7 c- D
simple.CloseModel();
% g# U1 J/ } j+ }. l WScript.Quit();
( `, P& O# W/ i, ?) q }
% P3 L# M/ O! Y! I+ ^} " d/ ^# J4 r6 d
! T8 h- i) a8 t/ f/ h+ }
simple.StartSimulation(".Models.Frame.EventController"); 9 y( L) t% N9 z
1 Q" B- V7 f( E" ~8 }; d+ j( k
if (simple.IsSimulationRunning()) % M) O# E1 R! y: m8 N9 ]
WScript.Echo("Simulation is running!");
4 Q: ]- n8 `( R# O 5 W; z6 |3 t$ G* f
// Wait until simulation is finished
) C, @. y3 o/ X* V/ Cwhile (!Finished) WScript.Sleep(2000);
; ]& C7 h6 e/ L# P* L " k- |5 t s# N3 C5 j; N; m0 J
simple.CloseModel(); " z- f/ p4 X, Z: Y+ ~
simple.Quit(); % V( A6 ~' p9 D$ A& I$ G
WScript.Quit(); . P8 s: X1 {' q/ A
1 O/ p8 z0 Y/ Q' d2 g- z8 D
, o5 T: @) e- N( Pfunction RemoteControl_SimulationFinished() - V0 c( _* V: F0 W
{
: p5 c/ |& s( Z0 f4 V WScript.Echo("Simulation Finished!"); |