Example of a JScript
" p* j# g1 v. uvar vbOKCancel = 1;
5 Q p" e6 x D7 Z) f9 c' @var vbCancel = 2; 2 y- j2 {* C* e" S; v! Q
var vbInformation = 64;
0 ^: f! Z# A$ r4 L- N% ovar Finished=false;
9 i, u D1 `) }0 j 6 F( r7 y4 d! C& a+ h# q* i
var WSHShell = new ActiveXObject("WScript.Shell");
1 b; _" r. ^+ ]; ^3 H + a/ J3 E6 Q$ A9 V$ }8 T0 S
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 A* [& A5 ?4 Y
; T0 ]( i9 ^4 n: h' `simple.SetLicenseType("Runtime");
9 I {3 X7 V. L* {* H
, H. t4 b' `! @. U8 Z. mtry 8 P5 e% k1 {7 S3 b
{
" R6 a, h( u1 w) n2 P. W // Enter the path to a model file! ~1 b' V; E- d
simple.LoadModel("C:\\Models\\Test.spp");
" u3 S0 A6 u/ r9 e! G& W% j; w# J} 1 \# a8 ?/ D# Q' F
catch (e)
% {4 Y& E }$ M# s* I) }) m6 l{ 1 z) p$ K( S( Z& u: b. ]
WScript.Echo("Could not load Model!");
1 @7 `6 U! R1 M/ _8 v" z WScript.Quit();
" J7 u, ^6 N% F9 Z2 E# r4 a}
- n0 B+ `5 ^( U1 _
$ F G5 S# l" q v" c ctry
' H8 A: \8 _" a0 s7 b. O9 o{ 2 g% o4 {5 `% d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) h1 _5 d9 v" H, Z! x- {2 Q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & P4 K2 n/ ^+ x! R( ~
if (r == vbCancel)
7 K. @* a0 n5 E% ~8 m7 i+ | { : I8 A0 w7 l( ~* o7 D. z o# Z" B
simple.CloseModel(); . g: {8 @1 U( w# F
WScript.Quit();
; y: s! \# _2 b4 M' A& r3 G7 o } : _/ ~. l8 H0 F) W
} ) N, n0 }: l1 j M6 G
1 T! p; r9 X7 r) m* v: esimple.StartSimulation(".Models.Frame.EventController");
' J: ~- [' L' e6 a! h# } # i; R; t% u! q
if (simple.IsSimulationRunning())
+ @* {2 t2 y5 |' @# y$ |+ V WScript.Echo("Simulation is running!"); . V/ G5 Q# N7 a( w
0 @ d8 ]1 e5 F; v+ k
// Wait until simulation is finished
0 T! w0 s6 s2 Owhile (!Finished) WScript.Sleep(2000); 2 K' d" }# C: H6 Q- t7 t7 x6 i
O4 J! v, p- Y; e: n+ {
simple.CloseModel(); 0 \ ]: Q9 b" Q/ h8 B8 V# d6 n
simple.Quit();
- u7 J+ a. `. I0 L, [) UWScript.Quit();
/ Q! ~- [; t7 }* B
7 W2 S B7 l/ {! T ' P/ L/ O+ \( s( k) l3 i% F
function RemoteControl_SimulationFinished()
) ~2 H$ U) y4 c{ ) P, ^- q9 U2 g5 w( w
WScript.Echo("Simulation Finished!"); |