Example of a JScript
3 s" V! J7 o' C: I7 Nvar vbOKCancel = 1;
$ D2 f0 W- o" P2 ?; e+ {% Mvar vbCancel = 2;
3 z9 c; b( ^! H5 H6 ?. W8 Hvar vbInformation = 64;
8 r2 {: O4 y% `5 w% p( g0 Lvar Finished=false; 5 w$ D* A) u. [5 S5 X. p/ N
6 R+ O+ _* V* G5 B4 N) {1 E* j' X
var WSHShell = new ActiveXObject("WScript.Shell"); 7 ^$ C9 i- W. `2 s) i5 Q
: `7 A# U* S0 D9 R1 Y" \7 O' C! Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 x; W$ P; h0 ~ r
+ h ]7 W, ?+ @# [% ?& [7 v4 P7 ~simple.SetLicenseType("Runtime");
9 O9 E" J- K& C. z6 X4 `/ s
! L i1 T" h4 \+ ^% B9 Htry / N1 p8 p0 t; z& B. H
{
+ ^% O( }% v) b // Enter the path to a model file! - g. i5 p) b$ R# a4 }* j/ B
simple.LoadModel("C:\\Models\\Test.spp");
; g) V, y; S* G3 y7 M# j0 i# X}
( z' P7 ]/ @' W# {catch (e)
4 ~' V# p/ r$ V/ A{ : X0 y# m* O' P: a5 F' V$ N' i
WScript.Echo("Could not load Model!"); . O8 |0 z U. {9 G0 D' U, G+ R
WScript.Quit(); : y# z' A" u6 P/ \* `5 s
}
' k$ U; s1 z. [$ | 9 m) v- x, v- D6 q" N
try ) f6 g8 s% g1 {4 s0 W
{
7 @5 }9 F( ?4 v0 R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . U" u5 r$ I9 G4 T$ J/ R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 P8 `. p, D# q" t! |: { z
if (r == vbCancel) 0 Q4 B$ z. L F" X
{
7 {" \. A; F) d% g simple.CloseModel(); 8 M5 W$ x: l" {! m$ k
WScript.Quit();
# ~3 d5 o, a0 J, S9 A/ j } ; ?# P* h3 h/ K8 c, d, F
} 6 V! ~3 }) n0 t, I# F- J
1 R9 r) z7 h' |' |' H8 ]; Vsimple.StartSimulation(".Models.Frame.EventController"); 5 B B. o: I3 o' L
. V" t- T! ?* s! @
if (simple.IsSimulationRunning())
; u. R: T# ]6 e# ^ WScript.Echo("Simulation is running!"); ( U8 R7 Z/ V. ~ e" a
# d, [/ Y" t# N4 P- m: q
// Wait until simulation is finished 1 x+ J- G3 j, D0 q1 \$ L2 k% i
while (!Finished) WScript.Sleep(2000); . x$ D7 @) Y4 \' v* H
; j, l! |/ O8 x! t
simple.CloseModel();
) W6 ?' X5 K1 a, |4 fsimple.Quit(); 6 i2 |2 t' h3 a/ z
WScript.Quit(); - U# W0 r$ w+ W& |. x; k& \2 r. \3 O
0 e) n }* G1 k$ l! M# C+ t
2 h' X) x6 M& M% s( r6 W( pfunction RemoteControl_SimulationFinished() 3 Y' q# c5 G: z7 H) P3 q: w" f; c
{ 6 {, y3 A2 [# K5 O& Z* d
WScript.Echo("Simulation Finished!"); |