Example of a JScript + L) N; j( U4 g
var vbOKCancel = 1; * u% ~; H3 W! K: z! H
var vbCancel = 2; ; M! J7 Q$ y: v r9 v3 T
var vbInformation = 64;
& `" Q# O0 y/ y* t% X) Hvar Finished=false; : b: f5 i; T% z! R! Z
+ g- N# i0 e& H6 O2 y$ k- x5 Ovar WSHShell = new ActiveXObject("WScript.Shell"); ( P: M; |8 S# I9 D! d
* W( ]+ f2 S# I4 C
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 v! b. D$ n h" W
5 I4 G. S: r) K1 |simple.SetLicenseType("Runtime"); 7 d" D* ?9 k! b% k
, k8 s) B$ |+ r( e
try
1 G5 L( s; P" {0 y- K{ $ R* K2 h2 b$ |
// Enter the path to a model file! 0 ]( {( i9 Z3 \/ a* _' K& y" E- i
simple.LoadModel("C:\\Models\\Test.spp");
( z, X, k7 U/ Z. ^5 i [} 9 J8 }9 e" K' C/ D
catch (e) ) ]5 O. E {% r: N+ {- ^; f1 I
{
; u+ d7 |3 ?" Z' V0 w1 @/ D' j7 I WScript.Echo("Could not load Model!");
$ [7 X% ^" A2 E2 w* b4 u7 ` WScript.Quit(); 1 X) t- P. r. F5 _9 m) }3 R
} 7 p u* \0 Y6 H4 C# N0 q: P
0 e2 X y Z6 K4 b0 p! \6 {try . U) F$ {; Z! M9 g$ b# f$ {
{ * F" ^- I Q& }5 Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: a: x; j' x) q( W9 x: M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , `! H; h1 h: ^6 l
if (r == vbCancel) 0 E% }2 S& H; J. n2 o/ v: R
{
$ G+ b6 Q8 ^4 u simple.CloseModel();
6 L* }. O4 j, y WScript.Quit();
# G1 P$ M0 m. U/ B3 o } , C0 N# `- @3 E6 R- W
}
U9 f+ ?+ Y5 r( p3 e4 O, @# V # j( C9 f/ n8 [ O
simple.StartSimulation(".Models.Frame.EventController"); ( w; {" s0 b" [* O
" R8 P6 L+ ~% c9 }) p; `+ ]( f
if (simple.IsSimulationRunning())
0 ?' @8 E7 ^ S. R2 p, ~, P3 g WScript.Echo("Simulation is running!"); ! Q. W9 I4 M. F7 H1 d
) Z# `$ p `: P$ z! X* U- n) E// Wait until simulation is finished " _1 O( O6 n& X7 }
while (!Finished) WScript.Sleep(2000); 0 x/ t; b& b h( u
4 [- S; j+ l- Z8 d @% y( e) wsimple.CloseModel(); ! _3 Y9 G0 B& ~9 B/ y
simple.Quit(); 2 f7 k. @: Y: q) B f
WScript.Quit(); . I# I. R( O, A. S* g7 \6 s$ f
& {$ y8 @+ e5 g$ | ' w* R% R& j5 X6 F$ B" b7 i
function RemoteControl_SimulationFinished()
; s) S4 v- W: F5 F$ w{ , B2 J6 D: z# \
WScript.Echo("Simulation Finished!"); |