Example of a JScript
/ i+ a& D( r$ _; i/ P% u6 H, L0 J6 Ovar vbOKCancel = 1; 9 y8 t" \- J* G, p3 @1 T
var vbCancel = 2; # x, a9 [/ L! d7 t J- S( y
var vbInformation = 64; ' }' m t# W. z" }
var Finished=false; ( \/ }# u& a$ p
' \2 m6 K4 |! fvar WSHShell = new ActiveXObject("WScript.Shell"); : y5 b; d' }0 D) j# G7 L
. j) y( w! n8 A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- B e* j3 E% ?. S5 i
1 k' z- k: C3 A; g: S {simple.SetLicenseType("Runtime");
- E2 r6 Q. r) T4 v( B ( ?8 g& F" x& z' d
try 1 ?. d. b6 [' z$ Z H
{
* Y; Q1 M; P/ o- g3 ^2 }# X& D // Enter the path to a model file! 4 n- f; e/ Z7 k5 A' ?4 Y* t
simple.LoadModel("C:\\Models\\Test.spp");
9 j4 W: z6 ~, D& U2 ], W( @} * A- f, y8 c( }4 q: ?! t0 O7 H
catch (e)
8 v% |# R, K3 T5 ^6 T5 ^- u9 V{
( Q$ h" H5 S# w8 @. N3 \ WScript.Echo("Could not load Model!");
* T0 h, M6 S4 K2 {& ` WScript.Quit(); & u- ~; d; ?+ Q7 a5 `
}
+ Q" a2 h% F( a
/ |% ^3 T/ G! d& D9 Utry 2 a- V8 V9 `2 M9 I; `; f% }
{
& e+ I7 C5 O! Z* v8 `1 ]1 x1 V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% h' D: ?1 C% W: y: ^' o, j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" U& n& g5 M$ }6 h) m. ]: b3 g if (r == vbCancel) " S0 |- J" `+ H
{
& R/ t! O% B- ] simple.CloseModel();
: I. |; f7 `+ ]$ B( l WScript.Quit();
2 j* X* S" a% c% ] }
; H- ` n1 t0 z$ j& \}
+ @. f* V4 ~& J. @
7 O. ` |/ D7 x, X5 m! @& ?simple.StartSimulation(".Models.Frame.EventController"); % A5 f9 I! k# ]) z: r3 H
( Y2 v9 c& N4 d6 eif (simple.IsSimulationRunning()) 6 i9 R7 K9 [. [5 n( z( Y* ?- k
WScript.Echo("Simulation is running!"); 4 d. P* K6 E$ w1 C) w, F+ Q
+ J! [8 P) Y4 _2 }
// Wait until simulation is finished 3 g% U& j8 p. ]# ~" {
while (!Finished) WScript.Sleep(2000);
0 `" _$ b, S1 u4 e - W) c& J- X% j/ C' W
simple.CloseModel();
% y8 y# U3 z U2 V9 V; R. rsimple.Quit(); 1 a3 }/ n1 O8 J1 r0 f4 m5 d) N
WScript.Quit(); 8 v ?4 `. o5 w" a3 f5 d
/ Q- t0 B: |/ _: p" _" [2 z 6 F) _8 P, q3 @
function RemoteControl_SimulationFinished()
# [# g- m7 l& f{ # |# W% S9 E S& D8 k6 D1 j! |
WScript.Echo("Simulation Finished!"); |