Example of a JScript 8 ^# i/ g l) P c/ u+ M
var vbOKCancel = 1;
0 v& [) G8 ]) t/ d, H( Gvar vbCancel = 2; 4 N) D; W' J# G% [1 q
var vbInformation = 64; ! [; u/ C' L. t
var Finished=false;
8 l6 S8 J: b+ x3 P+ o& E ( m8 Z3 Q6 m3 v/ m+ q5 Q& n
var WSHShell = new ActiveXObject("WScript.Shell"); ' `; e4 B2 ^' |. S8 g1 A! \
' A$ b* }3 e* w! ] Z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, i2 { P2 L( D; \. d
8 _9 @' d& y. `0 esimple.SetLicenseType("Runtime"); ; d) J/ v2 w9 s+ m" u; x9 i" L
! J4 z3 b$ e- A% | F3 l
try
1 O- ~/ U: Q* U* X5 m6 r! [. b{ ; b6 N+ G& _% j+ F. y
// Enter the path to a model file! 0 X* t6 |2 R7 W& V( W c
simple.LoadModel("C:\\Models\\Test.spp");
$ x. q6 |& {- h" J! s! G}
& d2 m2 ?4 ^' g) |- l* Lcatch (e) ) D" H$ W. ?( J# Y# i/ Y8 Z
{ 4 A9 D, p4 J( l" T) I# r
WScript.Echo("Could not load Model!");
4 U/ T1 P: Y) E& t& ?( { WScript.Quit();
/ _2 \& U6 R% D1 w}
, l# P6 k$ J; @
Y% y( d- D$ Ytry
0 e1 f4 Q' H- L4 d{ 6 @. [# m+ b: D6 i! n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. c; E# B" [2 I r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: V; `# U# k/ U2 g if (r == vbCancel)
" G9 U: R' V* Y$ S { ~( N2 @4 D+ o: H/ \
simple.CloseModel(); " ]+ i: p$ v; \" b& Y8 N+ {( b9 h0 \
WScript.Quit(); - G- B7 _4 Z( I4 a- @1 Q4 t& g, `7 V
} / p% D C. _5 T8 S0 y
} * k5 i# j' l$ B0 J( R/ w; t
3 i7 g+ j( F0 k& V$ Asimple.StartSimulation(".Models.Frame.EventController");
8 f; L: G! t) @& n: c
$ ^$ b* z) J, [if (simple.IsSimulationRunning()) + L0 x$ v# \; o# C% }% b8 m
WScript.Echo("Simulation is running!"); - ~. t: y4 r2 `6 T
0 ]7 ^9 L9 c! @) }6 m// Wait until simulation is finished : ~. x# a$ B! A- _/ R, ]8 G% P
while (!Finished) WScript.Sleep(2000);
* _7 Z) ]! \, j4 Z/ d
7 Q" D+ T# d+ @! @" S$ j" R* W3 Tsimple.CloseModel(); 9 L4 e/ k' i# x j4 f
simple.Quit();
2 I( J+ Q4 v7 S% X# W8 K+ VWScript.Quit();
& Z5 n& ~* A0 m2 G( t% a( _
! W) m( G* ]/ m/ _/ j! N
$ A% M" O3 Z3 t! H! afunction RemoteControl_SimulationFinished() . F: P7 E# v) Z
{
( J$ q% U( j# y7 |4 ~+ u* L# D* z& t WScript.Echo("Simulation Finished!"); |