Example of a JScript 9 h# c7 r/ l7 l
var vbOKCancel = 1;
) ~! I* s. z& L0 b% fvar vbCancel = 2; 3 O5 H5 k: t/ P; c0 {' B: C# i
var vbInformation = 64; , V# v) B4 s, ?/ c" z4 l/ x& l* }
var Finished=false;
" U- B# O& G/ l" f% c$ s( X , P; Z. n6 l" T/ T. ]
var WSHShell = new ActiveXObject("WScript.Shell"); # t4 K0 E% i' S% z, ]
1 }3 x# e c/ F. kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 @8 B; Z; `9 s
- c! t" B* k; Z
simple.SetLicenseType("Runtime"); I" r, {/ F7 Y
' q9 ?" u5 Y# B. x* Qtry [5 U( X4 t5 v2 M
{ 4 b! v6 Y- q _. J \
// Enter the path to a model file!
* |( Z* m8 x7 C" o simple.LoadModel("C:\\Models\\Test.spp");
! V1 w, H6 y& k" l}
7 \! t* n# z+ U+ n% rcatch (e) $ b! w/ i0 M: ?: \
{
6 p5 F' v7 k# P5 g1 {- F2 c WScript.Echo("Could not load Model!");
2 e: G$ e4 w P: Z* ]% P$ l% ^ WScript.Quit();
" a! t! Y2 \1 a- g; I, r* [/ e N} 4 ]7 t& u: o% V e. C5 S! N
- M3 O. j+ y! z* K8 ]: @" B
try
# X$ V4 u! A2 w$ q{
8 ?( \7 ?% v/ V% _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ u7 C, E# f6 `- p4 \4 \1 { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + w1 N2 v/ K8 K4 J
if (r == vbCancel) , f2 C; C6 O$ s. w) ~
{
% K) b' [6 g' S' [9 W9 @" [/ _ simple.CloseModel();
: ^; J! w$ d; H, Z WScript.Quit();
# n. p5 D) j7 c3 h* h9 d }
) H* i: g3 e1 y$ m# F G; p}
+ A# \; t4 @6 i 1 n7 U, d$ T' m3 p4 p! O7 l
simple.StartSimulation(".Models.Frame.EventController");
p% s2 Y: z1 R! |; D# ]" ~ 4 D3 l$ g& k! T( y
if (simple.IsSimulationRunning()) & D1 v' U5 B, Y' k) \
WScript.Echo("Simulation is running!"); ' Y& g8 d5 V) D& q- _ b, F
0 @( C/ R( ~% V+ C) B// Wait until simulation is finished 2 s2 W1 X6 q! }2 \
while (!Finished) WScript.Sleep(2000); ( ~$ n$ Y/ k2 S# K! D0 l
4 I5 a( \/ r) O5 H0 L# H& v( }" rsimple.CloseModel(); % C5 M0 A/ G+ O I& k
simple.Quit(); 9 J+ p0 w7 K7 A6 W2 i/ r2 ~
WScript.Quit(); ( Y- y1 u( j+ B" P
5 [6 ~6 f6 o1 M' I
5 @. H5 J% ~. G$ e9 y' U" _function RemoteControl_SimulationFinished()
0 M a- D0 |$ W* |; w{
& V8 M7 f7 V# O7 h1 ` WScript.Echo("Simulation Finished!"); |