Example of a JScript / A! ]& w9 u1 E* h; L6 Q
var vbOKCancel = 1;
0 o1 w! _- i, E+ p$ R& u. V& W; h9 lvar vbCancel = 2; k8 y5 ?2 S7 v' o: W
var vbInformation = 64;
& R; U& N M9 ^) x" ]var Finished=false; - |8 g8 {8 M' c
( r' N! ]2 }6 g7 [( ovar WSHShell = new ActiveXObject("WScript.Shell");
6 x( I4 |! ]' i# U: E . y2 {. w$ d. j% q, t B n+ R
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) A8 l2 T5 X& g! y
7 r6 C5 S( O% O4 ~9 B% J6 [* q. Z
simple.SetLicenseType("Runtime");
; U0 }; R4 Y) I T6 U # Y' v* u9 m5 x
try : ~' f2 R4 b( E! y
{
. w8 @4 _# O3 N) U // Enter the path to a model file! * }( T" n6 N: c$ r8 P* y' ^! v( e) K
simple.LoadModel("C:\\Models\\Test.spp"); 6 Y4 i- i% O9 ~+ q3 v. q+ W
}
# a% A* Y' ?9 j% ^) B9 F; c% S3 zcatch (e)
( r9 n2 O c3 \{
' T- z; y+ D, }/ |+ k b* W9 ^ WScript.Echo("Could not load Model!");
, m' e$ {- D4 | WScript.Quit(); 6 k5 x& B0 A8 n8 i0 o
} 6 o! U' A5 z8 {1 G0 p8 y
; i, n8 V+ Q A3 F; A, N
try 4 O( K, z% u5 G( p$ y/ j$ v
{
( `, `/ A, ?9 {5 M& J0 m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; S2 d/ |: C0 M% A+ P: R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( V2 x. J, B1 v( t' i if (r == vbCancel)
/ Q& z% ~- C+ x- k6 T { * E8 B" w9 e$ j4 ?( N
simple.CloseModel(); ; p; |! m2 Y3 M( w4 Y3 Q4 p
WScript.Quit(); 8 i; N/ W# U$ d. `6 r
} 6 S) K& y! G! T/ z+ d5 Z s; V4 R
} 0 l3 z( y/ A# Y5 o, L0 n) ^/ s
: X; p) o3 N8 \1 [; asimple.StartSimulation(".Models.Frame.EventController"); # C! W6 U+ n3 u
2 B Z, J7 k3 M, B5 qif (simple.IsSimulationRunning()) J2 T7 y @$ v/ G# ]
WScript.Echo("Simulation is running!");
5 s; r; f" K( I5 f1 X3 N 8 ?& G$ [9 a! H* ~! |
// Wait until simulation is finished / g4 f/ J: j: T. o+ L" e: @! s& c
while (!Finished) WScript.Sleep(2000); + X* `2 L) {7 f, i
% t7 @: t9 @8 n( H% y( x4 I1 d
simple.CloseModel(); ) ?. Z3 [ M3 W2 F8 b0 X3 y
simple.Quit(); ' Q; t# f$ B" M+ U
WScript.Quit();
* e0 j8 f4 @7 p1 ~+ Z0 O . R1 a [& {7 J0 {4 R, c
/ o/ @2 T! O. d% u' s
function RemoteControl_SimulationFinished()
" Z* ]# x) d2 b; g" y7 |% z{
. P; a# n. q& ^: D WScript.Echo("Simulation Finished!"); |