Example of a JScript
% [; ~) j* C5 v- g" G5 Fvar vbOKCancel = 1; " X# Z( `+ S" O
var vbCancel = 2;
* _9 [5 m1 P) @% k7 Ivar vbInformation = 64;
* ]) D( K" K2 Lvar Finished=false; - M0 X& a3 R1 i6 ]- M0 R; F, `3 o
9 c* b, O1 I$ U) G7 `' e8 evar WSHShell = new ActiveXObject("WScript.Shell");
4 r; [8 S! V( K" E' }
, ]3 E0 L X( U) t& ?& E( avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 E+ \, \& b s% W
; V/ k' @4 M: P# ^; `0 j% Fsimple.SetLicenseType("Runtime"); ( @6 x3 j8 W/ e( N" Q8 ?
# ~. D( R9 r3 u% @* \5 m3 s& w, { V8 wtry 8 ^' \$ A9 Z9 ?! Q: i j/ m
{ / R- o5 L# Q6 R2 v7 g
// Enter the path to a model file!
6 n& t+ m. m4 g" p simple.LoadModel("C:\\Models\\Test.spp"); , N2 x" x) @* d, U$ ~; L0 h4 g
} : H$ U" F# v3 C
catch (e)
) X! j* j/ v6 Z4 w{ ! r& Z% }; {$ B( X2 t @/ J$ M/ w
WScript.Echo("Could not load Model!"); * m/ ]/ H% R" I' H( N1 j2 r. N
WScript.Quit();
2 P0 ^: M5 d' I: u}
{( N+ o- C6 E2 J5 _
$ j6 R7 K! \( B' {: i3 mtry 5 S' W: P3 t3 s+ y1 v; I
{ " U2 V, u8 Y2 f# \8 N
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" a$ ~1 y, w1 R5 W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% s$ [( L1 `$ a/ j0 a% T2 Z if (r == vbCancel)
2 y' f) y0 e% X4 P6 Y5 P {
. k6 p+ Z. c3 n# H simple.CloseModel(); ' a8 [; [1 X' X# V
WScript.Quit(); + C& J l- m8 z/ F& T$ M
} : M6 @8 W+ x# e( F8 e0 A* ~
} I6 n- p5 x0 |. N' ~! R0 P
7 G) d# K8 a) R0 }0 ?
simple.StartSimulation(".Models.Frame.EventController"); % N. c8 R( C& @3 A# E
5 a9 a. d: i* L! F0 q& q4 ]; a
if (simple.IsSimulationRunning()) # |! S$ K3 n7 Y4 H; f
WScript.Echo("Simulation is running!");
" S" |; `" Z5 G' S9 o; G C8 ?- ?
9 H) K+ C, j& Z// Wait until simulation is finished ! i! s$ c {' L+ w, ?& B* ?" W+ b
while (!Finished) WScript.Sleep(2000); ) a- Y' G) }+ ?. o7 j5 }# Q2 D
0 b, a# J Z$ w6 G8 ^, rsimple.CloseModel(); ( N1 B0 d* |8 K) ?% b8 B. I
simple.Quit();
* g5 t) o! b: w- {WScript.Quit();
' l- ~4 W/ t( W' u9 j% ^# {0 n, A
; @' x3 Y5 s# s9 q# |$ C T
9 h# c1 F$ S6 u. s* rfunction RemoteControl_SimulationFinished()
% x) T- r& f: V/ [( a{
2 w4 \* @! B' P( w8 x8 R WScript.Echo("Simulation Finished!"); |