Example of a JScript 6 g- Y: L6 n- r7 W
var vbOKCancel = 1; 8 Z/ e6 d6 @# L, ^
var vbCancel = 2; 5 P6 P5 ?" x* T8 @2 Q' e& `1 u
var vbInformation = 64;
0 p/ s9 W5 @9 g" Y8 ^var Finished=false; " ]! U4 C2 d5 b$ U$ h; L
. l3 A2 u8 M5 b7 M$ kvar WSHShell = new ActiveXObject("WScript.Shell"); 1 K/ u) u7 f* j. y3 Z: G# Y
$ m/ y5 I/ N0 ~: C# Q7 Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 o& i; K& f3 m1 ~" m
, x$ Z) x, r* X) k7 c, O4 l
simple.SetLicenseType("Runtime"); % i4 N7 P4 z7 S5 C; Q
. U s0 D1 m- `5 a! c0 |+ ~
try 3 ~/ T; \/ n Q0 |' E. r
{ $ w5 @, g7 B0 r( S4 n& v
// Enter the path to a model file! & I5 a: p2 W! H, ?6 e: ?
simple.LoadModel("C:\\Models\\Test.spp"); ' D- \$ V" E! ?# n
} 1 G! H; b, J* v! ~! C
catch (e)
2 Z {0 e2 C0 {$ N{
( K$ x/ I) s; ^ WScript.Echo("Could not load Model!");
5 l( {5 f- B" s% }: V& T( G WScript.Quit(); ! Z; B: b+ q; n" I
} 3 ~# D0 g4 n8 C1 L/ e# i- n
! j" \! g7 r* i' n4 O7 W+ Mtry
+ f+ B+ Y* U- a, A W+ I6 [- u{ . [5 X, ]7 T1 ?5 z9 X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 ~3 ~: J8 q. s* r
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 }+ c% e3 J* C' b# [ u; q) K if (r == vbCancel)
$ B+ V- e5 g3 o2 m) \ { & Q1 t3 l5 A. }0 D8 M
simple.CloseModel(); . a K S9 K, ] p5 @9 Y8 |" V
WScript.Quit();
/ t" s$ j4 g- Z }
2 H+ i! N: ~2 m' [} , N6 v2 q4 w6 B
# {+ M7 z) N# h5 G" T0 esimple.StartSimulation(".Models.Frame.EventController"); ' m& k! _& S: x+ R) `* Z
% i% ]) q$ G2 k! z$ i/ Pif (simple.IsSimulationRunning())
- S I- u2 `0 y9 ?* }, ]: X; F WScript.Echo("Simulation is running!");
3 a4 O0 M' @: ` ( B K! d% j; z9 G
// Wait until simulation is finished
8 y; U1 g& }5 ^( swhile (!Finished) WScript.Sleep(2000); . L- [+ x/ G3 c6 J3 x( P0 s- ]& I
* j0 K; C* ]3 L7 Qsimple.CloseModel(); 0 {/ t- | c% a' }
simple.Quit(); ( F/ |# L, ^+ E& }9 t, A
WScript.Quit();
6 ^! A' A; }3 R 5 c' Y2 Q/ v6 V4 b+ _
& m9 {7 J* Z) g+ vfunction RemoteControl_SimulationFinished() 2 L/ A: _) A! {. L
{ 5 A) E- {. n( d& h! J9 I3 G2 n" U# X
WScript.Echo("Simulation Finished!"); |