Example of a JScript
& C7 B6 B! T y# zvar vbOKCancel = 1;
5 h) U2 Y8 t) r( H% _9 Hvar vbCancel = 2; . J/ B: W+ `% G n8 K& @7 U3 r; O
var vbInformation = 64;
: {/ A: d& K7 Avar Finished=false; ' u* ?8 D- |* G6 ]" Y' C' |# X
3 Z. q; ]8 [8 s7 S' ^- Evar WSHShell = new ActiveXObject("WScript.Shell");
/ J( \* R, P3 r0 C; | : r) Q* u6 E; m2 L4 o) b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * R: p3 G2 M% Q8 S& W0 a
5 z( c- d( B' h( ksimple.SetLicenseType("Runtime");
7 \. }( d2 p" s8 R1 I0 Z
& h& t* K% ^/ |8 c/ @' Z' M3 atry # u8 V6 S- P- j+ { J
{
! c# t; g5 G0 f, i // Enter the path to a model file!
: r& w5 m: N. N1 I s simple.LoadModel("C:\\Models\\Test.spp"); 4 N0 D' M% V/ C8 ^: d6 W
}
! d6 c5 u0 T8 @: R; tcatch (e)
' x7 K* C, R$ G1 R. w: P{ 2 H% F. E: S2 [ G( }/ c% D3 g
WScript.Echo("Could not load Model!"); % j; c/ p/ v8 a: `( h" o, z( W& z$ d
WScript.Quit(); ) C* P7 b3 `) M* _9 ^* \
}
; U5 x& l/ U$ k* ^4 o
! M! o/ i$ W0 Wtry ! R/ d# I& |* p" b( e1 q
{ # s7 }- @, }( M7 v4 ?' |, q) B
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 G1 C* X! m# t7 `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ C4 H* |& z, F# G1 h7 T3 R if (r == vbCancel)
6 R& o5 p# O4 N/ c) Z" q4 V* X { 5 t( I, W/ `+ s/ x! T/ j$ f
simple.CloseModel();
3 B/ p# b5 G+ u; y2 ?* t# o WScript.Quit(); 9 F5 k$ Y& K& y: i7 ? F
}
( r/ g# F4 x) L3 k} * B& j" U/ Q+ W' N& ~6 g
5 |- z- L ~; J2 o. { h
simple.StartSimulation(".Models.Frame.EventController");
8 n2 |) @ k0 @- F
% i' n7 _% X' i1 ?if (simple.IsSimulationRunning()) + Z% R9 B4 i$ l
WScript.Echo("Simulation is running!"); # _ G* L# A3 s ]5 }7 F5 Q9 {
0 A+ Q8 m" Q) ^( f% Q }
// Wait until simulation is finished ( {5 n9 h( Y2 F( t: D6 r
while (!Finished) WScript.Sleep(2000);
7 a) P1 g. a9 _- m
+ _& ]( L, e8 a7 s! [- Qsimple.CloseModel(); / Y0 U$ i/ y# [: ^
simple.Quit(); ' }9 p7 H3 i( g' p# I7 o3 Q
WScript.Quit();
4 k. X9 q5 f0 U7 o2 A1 Z
! V/ s4 h1 I: i* J
# n9 ^ B1 d( e6 J' S- B4 Wfunction RemoteControl_SimulationFinished() # N' A- C* w( d. J0 d) o
{
9 |$ i1 Y y3 Q. i4 l4 C WScript.Echo("Simulation Finished!"); |