Example of a JScript
$ O% M) ?1 U5 ?* ^+ |var vbOKCancel = 1;
# d! S. Q5 l( A: x, |' ]! Kvar vbCancel = 2;
& X' |& ^& Q( ^9 dvar vbInformation = 64;
& [3 O" \* W7 g/ m2 G, @. N0 pvar Finished=false; ) `* h7 q) u a0 @
4 v; V e1 ^/ _4 I5 R6 Kvar WSHShell = new ActiveXObject("WScript.Shell"); 6 _ q5 \. r) d) s0 Y- l. N) ]
# C d. T4 L( @" M/ Q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 E+ Z1 A/ q/ W4 m& ~# q3 d
; W. e- Q) K6 @+ ~7 a9 Zsimple.SetLicenseType("Runtime"); 8 ^4 k4 O) V3 l' Y$ ]2 y
% a) @8 I v9 V
try 3 ^/ Q7 B! h1 n$ A
{ - P9 C$ a$ i/ I% U, M. o
// Enter the path to a model file!
7 a* R2 O" F2 _# y simple.LoadModel("C:\\Models\\Test.spp");
9 a( n3 d; i" o! O( P) E}
! [3 }% T( M/ Ccatch (e) " `( U0 U# _8 q( J# u+ q( t/ }
{ 7 t" }# Z0 Q5 X4 t* x" F, v
WScript.Echo("Could not load Model!");
A- a$ H2 v0 U' a4 m4 C WScript.Quit();
! z& J9 @ a. V" k. J* f} ; J' Q3 c3 F4 k1 O, O
' g& @& V) l( Y, ?try - d7 K0 I- \9 {& A# s1 | I
{ 5 B2 p9 W j) r: i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { z7 g# ^+ h5 _( l& P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ i. p0 r; Q3 |8 x* q if (r == vbCancel) 8 s. U, p& d/ E1 V" J4 y8 c
{ 7 v: @0 w$ c; A+ G' r
simple.CloseModel();
+ z) w2 m8 R1 ~ WScript.Quit();
/ W: V0 x5 G* w) z1 M0 ] }
/ A3 J2 r9 x% D J) A}
' a2 c4 U3 ~; U7 f0 _
2 C, V0 {* d! X- T0 I0 c, u# zsimple.StartSimulation(".Models.Frame.EventController");
4 x4 l }! c( F7 S2 r6 O% v' c 7 I5 e1 X* R- ]5 T4 O7 @; ]
if (simple.IsSimulationRunning()) 9 J# N4 n: L+ M0 {7 c& e' R" ^% ^% z) m
WScript.Echo("Simulation is running!"); ( r6 ]; C. ]) k7 t( c: ^% Q! \) H
2 y, H# u/ S" I0 L5 z, {// Wait until simulation is finished
$ ~8 s. Q4 h6 x& `while (!Finished) WScript.Sleep(2000);
3 b6 A3 R$ `! |. ~6 l) v
% C" ^; W4 X: Rsimple.CloseModel(); # D% g" P4 u v7 k3 {8 |% O7 @
simple.Quit(); . O c+ A! A% H4 `) f8 f+ s4 b
WScript.Quit();
2 r% @* I1 ]& T% P # t( V" @/ A; r& Y% A( W
, ^* ~( W! V2 Y. F$ N" Rfunction RemoteControl_SimulationFinished()
# l0 d# h& X' {{
1 S( s8 B; T8 B, Z) V3 _ WScript.Echo("Simulation Finished!"); |