Example of a JScript
6 ]8 J" K+ f } c2 @, A# a; T% dvar vbOKCancel = 1; 0 B. @+ o' i3 |- i3 m
var vbCancel = 2;
) c1 `* q3 Z# bvar vbInformation = 64; $ r$ ^# f* N x9 _ e& \0 Q
var Finished=false;
. d% H# s* x2 D) M3 K' K
[+ f4 z9 Q$ |( x% ^var WSHShell = new ActiveXObject("WScript.Shell");
6 D% T; P1 H' N) o% G. Y% X) N # \" h" a5 v; d; L/ Q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; t0 _# M4 _! ~- ?% Z
+ w7 M. @# H1 K7 xsimple.SetLicenseType("Runtime");
8 e7 i Q( `. {) o" p+ o! y5 r- ?
9 V1 }8 B7 y5 Q3 O0 ftry * M' A5 o+ p! c+ x+ M: Q& n
{ * H- x$ l0 y+ X: l' ]# G+ i. u+ |
// Enter the path to a model file!
3 ~8 m* w) ~. ]. C/ w, j/ }* o# M simple.LoadModel("C:\\Models\\Test.spp"); ~. w7 g! j: G2 R) O' O+ p0 [: f
} 2 [" U( F! ^& R: ^+ t. N1 f. y
catch (e)
, I: `+ Z) ?8 S5 f# l9 H{
) g! O1 M% P/ S# @. u WScript.Echo("Could not load Model!");
, z6 I. ]: x4 L7 K. }/ | WScript.Quit(); - d, B5 j5 P: T' C1 Z6 z8 M
} 2 ~% W' E2 }: u5 `! x% K
9 v& A0 J; e7 I* T" M% G) d4 Ctry
# q* h+ k; r0 B I$ Z8 ~& j6 M{ 6 p0 a# I* m5 `8 f% \, S4 t
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* v* y+ W: ? z$ o) `( c# q) p1 O G! ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , R- i8 Y5 `. c1 Y8 W' h
if (r == vbCancel) + Q6 G6 F' [6 t1 o
{
0 q- D3 Y( n% N3 n! a9 t! T% Y simple.CloseModel(); & Q& J+ a" i8 h( h
WScript.Quit(); 0 B" N+ L9 P1 @ F6 r* O
} - t, |! {9 c8 t7 t
}
0 W" A+ s7 C* m: Q5 v
4 i: ~( `8 d+ A$ lsimple.StartSimulation(".Models.Frame.EventController");
! Y3 U+ i& L2 g, i
6 U! F. C! b% \/ C5 @8 J. }if (simple.IsSimulationRunning())
1 j t5 R; l; ?5 L4 r WScript.Echo("Simulation is running!"); % u* R" h' y1 L! D }; O
0 E: T' V$ S5 U& U4 p4 {// Wait until simulation is finished $ o! Y8 T0 {9 c* g& ?' z7 y5 O$ V
while (!Finished) WScript.Sleep(2000);
3 _0 V/ r% I& U8 z
$ H, s; m/ R* w8 X9 W3 Wsimple.CloseModel(); $ ^. ?2 H* z" d$ L% Q, y# i3 i( Z/ q
simple.Quit(); 8 P, ^' x! u# `
WScript.Quit(); ) n. [) @$ v. X; g* f& J, v8 D/ N
: h9 |$ |- j- s8 h/ T; T. ~
8 j1 |: z( y# m+ F5 pfunction RemoteControl_SimulationFinished() . G7 a$ X n% V$ S
{
' M O8 b; ~ Z/ ?/ \; M; c( C WScript.Echo("Simulation Finished!"); |