Example of a JScript
& R4 m$ r' h2 m* Zvar vbOKCancel = 1;
: N# a9 R% j- x0 \var vbCancel = 2; * p) j/ R- e" J
var vbInformation = 64; " a( a. W, `$ \3 S' }& d8 ]8 w
var Finished=false;
8 ^- y+ t4 m* V' F4 Z( c2 e E( `
' W- m4 \* I& v# Kvar WSHShell = new ActiveXObject("WScript.Shell"); 4 K8 v6 \ c# C F m* E* i8 S
+ H9 \! m4 D8 x& A% Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 g; b2 W- x; C, _/ U) M) l
$ v% K6 I& S+ r# k. o, N; Ksimple.SetLicenseType("Runtime"); 7 a$ z. R* n/ J
' s; Z% f7 d5 S# p: b* A Z/ ~try ' g6 L# ^; A$ P$ f( C
{
' n2 m5 {! l' |8 a) F: Y // Enter the path to a model file! - o9 ~" x1 _0 q( X
simple.LoadModel("C:\\Models\\Test.spp"); 1 Z% ^0 B- \+ T0 ]# e* ]% u/ e$ p! e: ]
} * A1 K6 c2 T$ r
catch (e) 6 M: v5 P+ O. W: e
{
0 h: m3 F' ^9 X; b F! u WScript.Echo("Could not load Model!");
0 n% ? X- d7 A: ]3 _4 B& v0 [% ~" ?, ` WScript.Quit(); 1 T4 ]$ H4 F4 l) Q1 y
}
4 K: k! J* k: a$ {& I7 a5 Q t! S3 f' ]$ c3 N# T
try 5 h0 t7 L" y& L
{
" Q$ E; ?% S- |8 X simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ ~4 V: b% Y' m7 k9 b0 g, C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; W, l! t& D1 f1 D" |$ `6 n if (r == vbCancel)
: n8 C5 |4 Q- {. T" I6 P, S {
1 h) w$ d q' y t simple.CloseModel();
8 O, I# c1 T( ?* w$ K7 x3 } WScript.Quit();
+ R8 a0 s0 P* Q6 @6 ^ _ }
$ g) ^% i* F, A& o}
; }" @6 a2 P4 ]5 h1 d
$ H+ U% u# s' O% J* ~% Osimple.StartSimulation(".Models.Frame.EventController");
: P$ I% O0 x2 x6 b ` : W6 m; K/ m& ^' ?9 s$ y- j( y
if (simple.IsSimulationRunning()) 6 r) f: @6 s1 A" K
WScript.Echo("Simulation is running!"); $ k1 X& J* w j
) Z: R6 {! f6 c
// Wait until simulation is finished
' w% }1 F( Z* Hwhile (!Finished) WScript.Sleep(2000);
+ K3 r4 E9 ?3 I% p" Z- a* P: p" o; [; v $ }2 \1 V7 I5 t, T
simple.CloseModel();
. O' U, s; R: L' k# t. i9 x, rsimple.Quit(); ( s- d# F2 U- E4 Y, ?
WScript.Quit();
9 N+ x7 w* `& b f ( x/ R4 {7 o8 a9 p$ A
; H1 C- z w8 F4 y- Z3 U8 W% B [function RemoteControl_SimulationFinished() & w1 T6 t2 |& z K6 L5 p) f5 V
{ 3 a3 ?, D' K. N1 Q: p- a
WScript.Echo("Simulation Finished!"); |