Example of a JScript # d' U4 s5 `1 Q+ X, ^( t' P
var vbOKCancel = 1; & T) Q, V7 o4 d' q# ^. ?
var vbCancel = 2;
3 m8 N0 [. @3 C- Y& N0 jvar vbInformation = 64;
% s! l6 i, ]7 p0 Ovar Finished=false;
" N/ c; v0 H) }3 x2 O$ O
& f' [ s: r. ^: C7 Mvar WSHShell = new ActiveXObject("WScript.Shell"); 6 t9 Y0 P' n8 ~
8 [) R; F$ n; d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); D% q' p! s: H3 h2 H4 X
% {2 c2 |3 f; _simple.SetLicenseType("Runtime");
2 Y7 e; J7 T& h) B# l% K& y 3 v4 @# H" ?2 p' V$ O8 s
try
; V" o3 {3 u; g* ]6 o1 _{ 0 l2 z# M4 }& @3 `& u: e' E9 Y l
// Enter the path to a model file! ) H! |, G3 R& W' ?+ W4 F7 K
simple.LoadModel("C:\\Models\\Test.spp"); * ?4 p1 d% h# ^" t; |
} 5 J8 U' q4 `1 ` @ r
catch (e) . [" h0 e2 a% z2 X0 O- L! M3 ?
{ 0 y/ I" x' U1 C: H+ [
WScript.Echo("Could not load Model!");
, ^+ y- r% I g, \0 Y9 V WScript.Quit(); * C+ H+ l5 z$ G. B, F. c
}
[$ r. |3 E1 r7 |
- l/ ^ S; H s6 V5 B( Ktry
7 K$ j( e7 U* ~% y, G{
. n8 O3 R* U h( ], v- }; D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! s! W6 _3 k g' N/ ~ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ ~# K) d* W) f: J; S if (r == vbCancel) % y9 s3 n# |3 [. S
{ 0 ~' E. d* B9 A1 U/ z [7 V6 a5 J
simple.CloseModel(); ) {" V/ O1 Z% D/ i
WScript.Quit(); + u8 R8 U5 @. z! O
}
! H2 @2 D0 `9 K5 Z6 d} 4 y3 a# Z' d0 U a/ E
/ E4 T$ C6 @5 Q5 ?0 e, l5 Msimple.StartSimulation(".Models.Frame.EventController"); 7 y8 ^9 W9 ]# B1 b r
/ p3 N& t$ X) _if (simple.IsSimulationRunning()) " M8 W% `' N1 H
WScript.Echo("Simulation is running!"); $ ?0 h) u( {$ Y; [" k- v
2 o w2 R! K' O+ U
// Wait until simulation is finished 1 e- y4 G- y8 p
while (!Finished) WScript.Sleep(2000);
& q2 p$ n Z7 u6 x6 K# ~ ! ?! S# r, E2 s6 [
simple.CloseModel(); + V( T) M5 R6 q P" {
simple.Quit(); % {1 P2 T. d( u; R5 A) M$ g
WScript.Quit();
6 s2 i1 H r9 F. d. ]
; i/ _# B0 J5 R
' `# C' k5 N" l* B# ]3 ufunction RemoteControl_SimulationFinished()
! i5 \5 y) N+ ]* T{ 8 {! x6 P' m* ^1 U) V x
WScript.Echo("Simulation Finished!"); |