Example of a JScript
3 H* E; u+ d5 F! g4 b- z7 Jvar vbOKCancel = 1; : ?1 Z# f4 @4 p' D
var vbCancel = 2; ) ^1 S/ y: j% \& }+ c$ z! u
var vbInformation = 64;
2 f3 k; _8 g# a/ {7 u |var Finished=false;
' ~/ M, m% B6 [3 v( D' s
( U( D1 p3 q C s2 j! ~& yvar WSHShell = new ActiveXObject("WScript.Shell"); 2 r& n- T. S4 @/ k* n3 p
- C3 w" i7 J0 o1 q* u7 j# O& z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 Y: O `0 i ` 5 P8 i9 f6 |8 ]! j! W
simple.SetLicenseType("Runtime");
$ T) o Q% C" C" f 6 G; S! O- g& J) v
try / B% C0 u% \, `; h4 R
{ 5 I2 \& \6 a9 q& O& P8 M
// Enter the path to a model file! * o4 O) n4 s4 ]
simple.LoadModel("C:\\Models\\Test.spp"); 5 `# J" ^5 L, Z4 M* c$ ^9 |
} 2 u; R" |5 b- I1 u8 D2 Q
catch (e) 7 | Q$ }9 x2 @5 _# P
{ 6 d7 K$ w; h1 X4 G0 b- j# o/ f
WScript.Echo("Could not load Model!");
6 [) A$ n' ~: n2 r9 j) o WScript.Quit(); ( z) f) ^" d6 ?- @* { B+ K, K
} 5 R6 B; P# o9 d. ]' R9 m$ e7 e
9 e: _) q& D; Q8 ]: b0 L
try ; {' x+ l5 s3 J: g
{ 5 N% U7 {/ C# ^ C$ Q) p ^5 s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
t* P% D; U. c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: M# R8 Y! ~! M if (r == vbCancel) " {8 t9 m' c5 w8 A% C9 S# ~
{
; J) \- `6 `! r% u- F6 t0 L T, o4 k simple.CloseModel();
- c* g/ e, |- L( J& D! u WScript.Quit();
% d3 J; Q8 N9 I2 O( O& F1 y }
, c( l" Q8 j! t7 i; n: E$ b} 9 ~2 c& |6 V" l
7 \# f" B# _; i7 ]/ h( msimple.StartSimulation(".Models.Frame.EventController");
B; k/ E9 j# R
1 v e8 j5 {0 E" l& w8 c% n. vif (simple.IsSimulationRunning())
7 L) }1 X% c: D. O. x WScript.Echo("Simulation is running!"); ; K' P* f3 l T8 Z
3 p# w4 I. r4 Z( Y6 E- X3 x
// Wait until simulation is finished
: A, h, e3 N* R" owhile (!Finished) WScript.Sleep(2000); 5 g* s2 T j/ y
: _: I# G0 _5 r, L
simple.CloseModel();
; [& C* J3 C% p' ? g2 [- usimple.Quit(); ) K# f3 @# h+ }7 k. S0 m
WScript.Quit();
1 }0 S* b5 K E$ Z
- q% Q% }( d* R J
5 w/ e7 t. X7 U. U/ P8 Cfunction RemoteControl_SimulationFinished() 5 w T) h8 g* |1 z6 p7 _
{ ( x3 n- A2 h0 z w4 z
WScript.Echo("Simulation Finished!"); |