Example of a JScript ' l1 h5 A# i2 B7 M! c" o" {, r" V
var vbOKCancel = 1;
) _9 u* V# Z. z* V; bvar vbCancel = 2;
. T5 A; o6 P' }5 Z4 c0 B' U2 qvar vbInformation = 64;
* @" r7 N8 |0 `5 o4 x0 gvar Finished=false; 6 G7 P& n- } O( W) U
+ a9 j1 j0 h; T1 d" M
var WSHShell = new ActiveXObject("WScript.Shell"); 0 G5 C# r+ L$ }+ t, I
# e5 s' G5 r% j4 f/ R
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 \2 s$ e+ P) `$ k1 B7 t
' ~5 I& [! L. W- p: r* x1 Usimple.SetLicenseType("Runtime"); ( h1 j2 ]5 z4 [2 E X
& P8 k% D1 i$ O& `& R- ~+ Q
try ) G1 U% i6 V$ G1 d: _0 a
{
3 I1 Q/ u- F" K6 R' A // Enter the path to a model file! 1 v2 M) U5 _) H, z+ Q: H5 X/ K4 k4 x
simple.LoadModel("C:\\Models\\Test.spp");
" @+ @) w% D% S4 t, Q} 3 { W& k/ _+ `5 n! R
catch (e)
0 ~- {: G. D4 ~9 ^$ R{ . b* o: s( ^) C L3 @# R$ L
WScript.Echo("Could not load Model!"); ( U' ^ [0 I# f
WScript.Quit();
1 U& i/ k |- T# s}
. {; G( o; O: w ; l. s3 @& Q$ D S1 A- p2 p6 z6 @1 i
try
" X ~5 w4 U5 T- u; T4 `. L{
1 B0 G' P/ d) l. B* x6 } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
l$ l8 r' I- I L, p6 o r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / q o# p2 M! J# @7 n, v/ d* t
if (r == vbCancel) $ r$ g" Z8 h! L$ O0 @( c" T. O
{ ( [8 N: V' P) `7 u. i
simple.CloseModel(); : ?5 V& T6 | m7 M7 Q
WScript.Quit();
% y _9 V& ~" B" b4 o7 v } & Y5 R' t* i2 J$ g4 h. N( |2 g% |
}
: L8 }5 v3 W) T/ l5 z! L $ H- F2 K! B* d% w8 ?" P
simple.StartSimulation(".Models.Frame.EventController"); + N4 i/ b- R" n
3 p" X3 k- z$ M* w7 b: o4 @4 @
if (simple.IsSimulationRunning()) # A2 Y4 X e Z+ ~8 ?- `
WScript.Echo("Simulation is running!");
+ D8 j) \% w5 \8 `, B6 Z " ~0 ^# g! y+ w. i/ ]4 t
// Wait until simulation is finished ' y0 c i, O/ a% @
while (!Finished) WScript.Sleep(2000);
0 J# L1 o! j4 F4 u 2 s6 s& G/ F# F0 e
simple.CloseModel();
0 o. u; E* @) s5 J1 z$ p+ }" F: Fsimple.Quit(); 1 b, x/ h! |2 c) Y! o( h5 _, ^
WScript.Quit();
5 Z, q3 Q. v! V o) `6 y2 _, T
5 O. _3 }- X3 A& H' x& F * L% {/ \+ V+ r/ Y) f# G1 a4 k
function RemoteControl_SimulationFinished()
( ]! x% |9 l; n: \; m{
) b- A* z4 a6 E w1 V6 C WScript.Echo("Simulation Finished!"); |