Example of a JScript
% |9 a, \) U1 R3 d! Pvar vbOKCancel = 1; 6 `+ |/ Y! b$ Q) ^9 y$ Q+ a# `. ^
var vbCancel = 2;
2 q. w. Q. `0 D/ nvar vbInformation = 64; . A; M. b" r( k) S* k( ~) Q
var Finished=false;
: g* [8 u* a8 b2 U7 w . ^9 d# `: {( s& j, I2 P% h
var WSHShell = new ActiveXObject("WScript.Shell");
! x3 g/ D, v! [. b5 l 5 T$ }2 U3 L' p0 N5 }) v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + S2 r. I0 u; |, J5 d4 M$ d9 M
0 X9 _# i* E. X( w$ y
simple.SetLicenseType("Runtime"); & l8 E* w5 q" m5 `2 ]
' Y/ h% r2 G$ a* f4 F9 X2 Utry 9 q2 c2 R8 I& X
{
* F9 ?! `0 M3 d5 i! A // Enter the path to a model file! ( n. u+ \7 U+ z7 e2 G
simple.LoadModel("C:\\Models\\Test.spp"); 2 F% V/ t; K) p
} $ z8 m5 A) U; z; R" @) W
catch (e) ! `# z6 ?$ B- `( A. \) W7 B
{ # \: ~; h$ T0 ?8 E p
WScript.Echo("Could not load Model!"); ( v+ K4 r7 r- u- `1 h
WScript.Quit(); + o8 S5 m$ G# i" [/ h/ H& Z5 d1 \
} $ Z/ L# |' F$ Y ?( x
8 t) ]6 @9 G3 D
try ) u) b' a& h% J$ ?8 L; H0 Y3 a3 U
{ : G" [4 i9 f: ]0 {: |' A( C' J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " O( K2 h0 a- U, V1 U1 {) x) k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 ?; X. H5 r; [9 c9 W% G b if (r == vbCancel)
, B% v5 m! L& n; L: I { : o1 O6 s0 N$ D) W: W
simple.CloseModel();
2 E9 g4 V3 R% g' A" \) q WScript.Quit(); & G' ~; {8 F" D4 w% w# u
}
( B8 x& x5 J6 s}
# T( _ U' [' S3 t8 A
3 b& o ^1 v* {( C6 b4 n0 psimple.StartSimulation(".Models.Frame.EventController");
0 i6 o `% t' O9 ~$ X
; @" M3 R2 n( Z5 u4 Z0 y+ S% L4 X2 Nif (simple.IsSimulationRunning()) - q" N) ?8 i( a1 _
WScript.Echo("Simulation is running!");
6 q- q( \) `! P/ E) |9 p 2 `5 j: h. d( ?; B. f' }0 S6 W
// Wait until simulation is finished " @( T# F% \$ y# e) `# U Z
while (!Finished) WScript.Sleep(2000);
4 l0 T: } X4 c ' c6 S( p3 ]5 C
simple.CloseModel(); 7 D& X |. K2 ~
simple.Quit();
6 s/ Z7 t( |9 P% N0 {% W0 ]9 PWScript.Quit(); ' l2 Q6 f( V1 |6 {7 }. H
- q8 m4 @3 O' ?* J! Z9 `
1 ^) V$ Z& b M, K; E6 yfunction RemoteControl_SimulationFinished() + `, P. n* h @& h B C
{ ) L* h/ U3 E* o- [* Z
WScript.Echo("Simulation Finished!"); |