Example of a JScript 4 }- C0 {8 u" o
var vbOKCancel = 1;
+ l7 D% C: s4 x( f1 Zvar vbCancel = 2; , F% I8 B% z) s" r; E) R
var vbInformation = 64; ) ]$ Q* @7 l3 C- C4 Q+ S: L( u
var Finished=false;
4 d5 v' P9 x# Q) @: W 7 |3 j' t$ H+ | E1 ?
var WSHShell = new ActiveXObject("WScript.Shell");
R: D9 k1 P1 h' M9 Y
p5 [5 p# j/ g @; P! z3 ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* |" M( u/ k2 G / R! `& u8 Z" H7 v& Z- L
simple.SetLicenseType("Runtime");
& @' w3 g3 s/ j
9 e4 i+ S. A- _" a# F5 T: \, a/ itry $ @" U7 q2 |" j$ A& [; T
{ ( w% ~+ {4 o5 L3 t; [
// Enter the path to a model file! . i7 a% H& h' n5 I
simple.LoadModel("C:\\Models\\Test.spp"); 7 u# ]6 T" o) @4 N; J9 c0 a& v
}
6 ~- Z' C. T; \( V+ S# w5 }. Z2 ]catch (e)
5 i1 z. I8 W, V6 |{
0 R* n9 o$ k. V WScript.Echo("Could not load Model!"); ! c6 a0 h2 k' e6 K9 @/ O
WScript.Quit();
1 ^8 i* i+ Q1 t! I) G} " Q9 _* |: `! @6 E& s, ?
0 ~' K5 F% y0 etry , e* \8 P( T( J) `3 T( ~/ M
{ ! L% k! Z- R6 g) G7 {
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 m9 B& y J/ Z: |' b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 z+ o4 w- ?4 ~9 o' J: S+ ? if (r == vbCancel) ; z+ N: y# W0 M4 T( R3 Y
{
/ o6 t7 y' B: K. ^ simple.CloseModel(); $ M" C4 f( @5 m
WScript.Quit(); ! y4 L% a8 Z; Z, O; P
}
$ {# | h# W5 B q+ C} " @3 t# M6 _& p$ ^" P
8 }. Z$ K' C8 W6 B
simple.StartSimulation(".Models.Frame.EventController");
( X0 c1 K5 Q8 M! f2 {
5 E9 q# C4 V/ uif (simple.IsSimulationRunning()) - i$ ~2 |4 V' v% {. b* v. u# o& y- l! ~3 N
WScript.Echo("Simulation is running!"); 9 R' I! }7 G1 c% i
! I7 U; ?8 J/ J// Wait until simulation is finished 9 }+ U$ N, }5 `1 \6 b
while (!Finished) WScript.Sleep(2000);
( c D6 ` z' x6 m # g& Y, ?5 C. q: G
simple.CloseModel();
* F, |, B1 p$ y/ E7 Y, \simple.Quit();
0 p1 w3 j J; tWScript.Quit();
" I0 q8 M* w+ ^$ g4 E. n
! ?* `+ g( b# ^8 K' U9 f 4 Z6 U9 ?" \7 X0 n% l; h' | e- a6 T% J
function RemoteControl_SimulationFinished()
; ^; D9 X3 b) _, A{ ! s+ h8 x2 f$ t% A- j6 C( V
WScript.Echo("Simulation Finished!"); |