Example of a JScript 8 [. D8 s$ N V; {3 H, X8 ^. w4 j8 h
var vbOKCancel = 1;
# R' p" o, }$ f4 Y0 i& N8 Jvar vbCancel = 2; 2 ]: \5 N$ C. Q% t' H: j
var vbInformation = 64;
7 ]; K; t" H( u7 E3 N; W7 t9 kvar Finished=false;
q+ [% X' M8 G0 y" f( ?3 Z7 ~2 }
6 H/ i* F0 l" f8 K/ x" Vvar WSHShell = new ActiveXObject("WScript.Shell");
" m& D' I# a: z$ T$ Q2 Y1 }5 k& ` 9 P$ p1 g! [- v* H: Q& g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); s7 t/ E' z$ f* c8 S: O
3 T- [, p. H. a, X
simple.SetLicenseType("Runtime");
! v! p7 c! _/ d/ I 7 h7 L7 n: x0 K- a% b
try 4 u+ D4 q4 {3 _% m
{
" F/ B J4 I5 C // Enter the path to a model file! / u2 D: w( z- e' g: F
simple.LoadModel("C:\\Models\\Test.spp");
% p% J$ G. k: G9 r. \} 9 y3 ]8 C& K6 y& G. G) A
catch (e) $ D I0 L+ C1 T( w
{ ' o j( J" I6 s' ^" r
WScript.Echo("Could not load Model!"); 9 N+ x- u& M' L v. E8 ~- }( X
WScript.Quit();
- z- D" i2 j, A. b}
w* h- X$ ` l1 Z
. B9 ~( L# x8 I8 }8 _3 `: p! Ltry
! C6 B. t: a% G8 i3 H$ k{
- B! y) g W' J/ H1 f+ i7 }3 M7 F simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( Y0 P6 [$ V0 Q% ^' K1 x
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 l; z3 N0 m: ]& \
if (r == vbCancel)
. @& H- T& I6 J/ f: Q { 2 g, n/ S1 N2 C! q! W3 ?* n
simple.CloseModel();
: \* u6 I# L0 l' [$ g WScript.Quit();
7 P, h0 @, ?( Z6 z3 e# p$ C } : H7 F% `. J- Y0 |, g( e) Z
}
% O8 |" T7 `: u) O, x3 T# P6 p 6 B7 n' V; N! d
simple.StartSimulation(".Models.Frame.EventController"); ) n8 ]$ J( O3 Y: a" Q1 s- T: b% x! |
7 w% s" K. U5 s% S. ~$ P
if (simple.IsSimulationRunning())
$ g- Y A+ P. F* t6 H# P WScript.Echo("Simulation is running!");
% j5 a) P0 U6 d+ z, F
" c' O6 A1 @* x1 P2 I# t// Wait until simulation is finished : E3 N+ Q f( C5 n+ Y
while (!Finished) WScript.Sleep(2000);
# h* a' j% K: \
) u$ J* B( ? R* D# D' @. {simple.CloseModel();
! K! s7 N5 g6 U" k" {: {simple.Quit(); 8 d% g" Z7 r& T/ i) l
WScript.Quit();
& S! I1 u9 S) n0 t& b2 q" I& E / z: s# ?1 X9 \$ \# x3 T6 b1 Y
& \2 t" ~7 L# h$ a! O2 ~0 ] t, r0 Xfunction RemoteControl_SimulationFinished() % v7 v/ \) z; f& F
{
& T. [; |8 a% x1 F3 Z7 o/ ^ WScript.Echo("Simulation Finished!"); |