Example of a JScript
. c* W2 r) j6 |. D' ivar vbOKCancel = 1;
% m$ p2 L1 s. T% u) v$ p5 hvar vbCancel = 2; : w1 v& ?- K: o
var vbInformation = 64;
6 ~( u7 ~' g8 ~0 qvar Finished=false;
' v- s6 U# X3 @8 N% M # I3 v: K+ L' p* V) D+ v0 o, T
var WSHShell = new ActiveXObject("WScript.Shell");
' w; [3 x: ]1 m3 z$ ^8 P & a% p9 A5 W: Y9 X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . w5 s/ ?( _: _
. x2 `1 q, p0 H3 D0 [! z
simple.SetLicenseType("Runtime"); 8 ^' y |6 H4 p! p8 d) d: Z
( `9 Q0 ] B7 b2 Q. F! A; K
try
0 j9 p& Z/ k, i! J o{ ) U6 [" G0 J1 q- ?- Y# P8 ^
// Enter the path to a model file! # t" }( I+ c) j. n
simple.LoadModel("C:\\Models\\Test.spp");
* c! ]' W6 i5 P- q( }} " Q' t6 H9 W% H
catch (e) / g, O% M$ {+ @9 H3 C! i% \ v
{ : y" [% ~& w% E" |0 |' r9 L
WScript.Echo("Could not load Model!");
# L q0 \. K0 R! m WScript.Quit();
. }6 ?' i/ a5 X3 _. N& t: _}
: _ ^. q% q4 }; }+ D 8 ?3 ~* k5 D# d5 B7 }. } M
try
8 P- N9 _6 E) X% q{
: T6 w+ W; ?! { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " e8 e f; W1 w' n2 m
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ }: m3 y) r% ^) \ if (r == vbCancel) 6 c( s: a. f% W: f* E
{ , X) D+ z# S7 z4 {7 N% ]: z( q
simple.CloseModel(); ( J- F5 J$ W0 [) _$ l+ k
WScript.Quit(); 6 J% S# ` \" p* l4 r: a' f
} # o" M( U& `' x5 C+ M9 Z* N% l
} ' f0 P6 g E% E, l
8 m+ }, |5 U7 osimple.StartSimulation(".Models.Frame.EventController"); + X" ]9 l3 g0 a' E) l
3 O0 {. B0 P$ K/ \7 hif (simple.IsSimulationRunning())
+ B# ?9 J$ t' Y5 g5 q WScript.Echo("Simulation is running!"); & c( d" [( R2 w+ V6 O( m2 j
5 ?6 d s7 ]0 ~8 f- y
// Wait until simulation is finished ; r2 t% i/ ^3 [+ y) j
while (!Finished) WScript.Sleep(2000);
0 v! I0 h; f0 y: R ( m$ m; Q$ `5 j- z+ @: ^1 X: W# R. a5 {
simple.CloseModel(); 0 e! V6 p9 e7 {: B$ ^; B2 \/ |5 b
simple.Quit(); ( c6 S+ o/ U! H* ~ k
WScript.Quit();
; \" S6 c1 f- {7 r1 U
7 w. M% `4 I- L: H* R
& Z' e, _2 i1 R3 n1 o- h# Tfunction RemoteControl_SimulationFinished()
$ T% g# I5 K5 a7 E; W{ + [; A2 w1 x/ B
WScript.Echo("Simulation Finished!"); |