Example of a JScript
! W6 r$ w2 u+ I" m$ k$ evar vbOKCancel = 1;
9 |4 C( k6 D0 Svar vbCancel = 2;
; r( ]0 G2 G4 {8 u6 v) }3 V1 vvar vbInformation = 64; & B8 l2 ^9 z( O2 h7 Y+ a
var Finished=false; & V7 N/ U5 U! U
0 j; s: ^3 @1 L
var WSHShell = new ActiveXObject("WScript.Shell");
- v! W8 y) l3 U2 R0 p7 Y$ c
# ~: T) y$ \ tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 m6 s3 _! O9 z' r+ n2 _ + |; s3 {1 U$ k* [1 k
simple.SetLicenseType("Runtime"); . T! O, P' j/ `' u1 _4 f+ ^/ W% h
7 V" ?3 }6 e. v/ k+ z( r8 vtry
8 Y2 k5 R* q, j7 ` K( C# e{
3 ~9 X/ a& {7 u( R$ N7 T: J // Enter the path to a model file!
. _* h, T/ a) j! K: f0 ` simple.LoadModel("C:\\Models\\Test.spp");
! b% a/ h. [- G* T, i! E. G}
$ i; u% B. H; Wcatch (e)
! _ R4 n: F' N6 Y9 p4 g( l# G{
% B6 q0 U6 x4 F" z WScript.Echo("Could not load Model!");
/ ?) q/ O& d/ {3 a, k WScript.Quit(); / K4 N8 t. R/ y6 Z( A# Z+ ^4 Q
}
# i9 U t$ u! Z- @2 r3 Y; H9 \. E - f" [) A; M9 f0 B# L
try
; I2 t+ Y- J- _1 p3 F{ $ _( K$ U* J; u) K2 }1 l$ L, @1 V
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ J6 d( v! U) A5 q5 n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + W- D4 f5 R8 L8 h
if (r == vbCancel)
, m+ ?9 e9 b5 t0 Q { 7 z( U; `) P2 M* I% O. ]; h
simple.CloseModel();
. z& i+ s* o# J# E, u0 [( V& M WScript.Quit();
6 f% ]& F" w0 l$ a; X7 W- w }
/ A. b' V( w# z# V5 ]} 5 d' B' |2 x2 p2 T R/ P
, y7 h$ Q$ E! T, {( M
simple.StartSimulation(".Models.Frame.EventController");
7 a! c0 d. t, e8 F& v R ( }* h4 H" Z* A5 }! P
if (simple.IsSimulationRunning()) 6 G+ O; Q9 O+ i, Z
WScript.Echo("Simulation is running!"); 8 l; }! r4 b& U1 j, f |9 s* N
9 |. a7 s$ j5 i4 `* }0 x// Wait until simulation is finished
( }, e; M6 I2 m7 a* Rwhile (!Finished) WScript.Sleep(2000); 3 Z. b, K) {: e4 E
- D3 N# z) a5 }! w' rsimple.CloseModel(); 4 s" n4 y( O/ e
simple.Quit();
$ @9 ?4 i$ a3 @" |WScript.Quit();
) x5 S# b/ m1 [7 x" _9 s& Z
: Y9 Z4 ~, Q6 i) _* ^! K
0 H; K+ m# t3 n" D5 J: z8 cfunction RemoteControl_SimulationFinished() ) E" Q2 c6 {, i0 D% _9 r& ?
{
5 f2 w, Y/ ^6 n9 G& J+ g4 b WScript.Echo("Simulation Finished!"); |