Example of a JScript * h0 p7 k2 i" f1 h& w7 U
var vbOKCancel = 1; 1 a7 j( B& z- I6 e% D4 [3 j" G
var vbCancel = 2;
- F* i! H) K! _* K/ [3 ovar vbInformation = 64;
- w# ^: m. V$ \& d! fvar Finished=false; , ?( z _( T/ t5 S- a9 d7 x
+ V. Q5 ^4 Q+ m! ^1 h( t
var WSHShell = new ActiveXObject("WScript.Shell");
; j: P# T' X% u. [) |" F , V; {: ~; q9 b1 c
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. Z5 x2 }) e; e$ Q1 {" r% \ l
& ?* E2 v( P1 \2 {simple.SetLicenseType("Runtime"); 1 f: W; w* ^ p& p7 k8 l' Q
. \: h$ v( E, i/ }: F+ Ktry K9 C$ y8 O4 x6 h
{ 2 O( o& Q. _8 g& Z, h
// Enter the path to a model file!
5 [( y* r: J5 f5 O7 S simple.LoadModel("C:\\Models\\Test.spp");
8 V7 w3 ]2 C1 u+ L5 B+ a} & z; k5 c7 W0 G. g: D
catch (e) - b$ Z" Y- R z$ I3 J
{ $ p/ M3 {6 R V" _: S
WScript.Echo("Could not load Model!");
/ F6 y3 f; h8 c/ }# m) z WScript.Quit();
# a) O9 I& C2 n/ o} 3 N: g1 o$ B( A. G* r/ p3 J6 q
# K X- d6 l% [. Mtry
5 H8 U5 b) L* G{ 1 w9 G; @* k* B0 s/ x n! m. T. f
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' [! ]% [3 c d9 k. A& [6 C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& g1 L9 E9 e9 P; B6 J# } if (r == vbCancel) 9 ?5 k9 T Y( M* K& s% o" w, N
{ 0 G, |' B- l3 A B
simple.CloseModel();
0 N& | s# s' V" |; H: K5 \4 ] WScript.Quit(); . B8 D/ T+ [1 i) a
}
# a7 ]: Y( T$ d; t} & r) q6 r3 t2 V; D
( _& X+ `6 ?2 R$ k/ i
simple.StartSimulation(".Models.Frame.EventController");
* B0 n. X* o8 O% u! Y2 ]2 e
( G2 b) }% `4 R: A4 O0 Tif (simple.IsSimulationRunning()) % p8 F! }9 J$ ~- k- [1 Y$ o
WScript.Echo("Simulation is running!");
7 ?1 `+ A3 u9 Z4 B9 S% Z# S/ B / ~3 j, ?3 |. @, ~) T
// Wait until simulation is finished
& m9 Z7 d' r7 D: Q2 x- h5 W: hwhile (!Finished) WScript.Sleep(2000); O( ]2 n1 p# x( _* X7 j
; q# \9 z/ U# t' F( O" i+ _2 \simple.CloseModel(); 8 t4 L! @. n- K- V/ e3 D
simple.Quit(); 4 D' L% ^" q' K% ], C# P1 @
WScript.Quit(); 6 R( L- Z+ M* b, i# e0 o
" u+ q% a P/ @ {/ a / h5 z% M8 n# H( S4 K {/ z
function RemoteControl_SimulationFinished() . J* `! x9 ~! k% n/ H) H' i
{ , [# H4 h( t0 D3 H2 T; b
WScript.Echo("Simulation Finished!"); |