Example of a JScript
# t# C8 K' a8 F: P& Q. _ \6 ]var vbOKCancel = 1; & N# ?! L7 |( C9 `9 u$ T y
var vbCancel = 2; ) b2 E2 m% `& s |# k! w7 Y/ e6 }
var vbInformation = 64; & Z3 g6 W5 i& v
var Finished=false;
+ I& o$ Q2 U) G4 { - ]$ D% m6 d7 D1 c+ _$ Z
var WSHShell = new ActiveXObject("WScript.Shell");
' u. c2 V1 ?9 X7 t9 F- _ 2 j: W- n2 M- |3 l; g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' N' ~/ S" n9 k/ E; p1 h( ~
- b1 @% b- L6 }. Y0 a1 J3 Osimple.SetLicenseType("Runtime");
_" Z4 ~- l" T$ g( O! t2 w . Q$ c8 V# w8 e! b* A g3 t. \
try 3 Y6 S# l! w8 q' C0 n) u
{ 4 o) ~; [5 V/ x: v" Q6 F
// Enter the path to a model file! 7 h/ z4 Y1 X0 V) y* x9 Z* o% y
simple.LoadModel("C:\\Models\\Test.spp");
2 A: n, e& k: d2 E}
" c: n8 z+ D/ N' B _8 P# ^catch (e) 3 U# j( }- m$ X, x0 P
{
% h( p* x( ~& g WScript.Echo("Could not load Model!"); ' E5 }' {5 |0 D0 B
WScript.Quit();
: v. v% a, [6 S4 L; W5 s}
1 G5 J- G H) d! ]; S8 Y; I3 Q! X1 f6 ^
/ S' L( [( j2 b3 }6 g# Qtry 0 Z2 N& c' B$ I2 P4 m2 Z: R
{ " i2 g9 `1 a @* y: G7 M
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( V& _7 Y/ U. ~& _3 m8 c1 ~5 N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 p# k/ B, q7 b- t: k( g, { if (r == vbCancel)
& L1 K! w7 I5 |* i# v { 8 E) W7 e$ Z ]$ q. D4 \3 F
simple.CloseModel(); & [/ x' O! @& r6 B' {8 p2 j0 V/ R6 b( M
WScript.Quit(); . e$ Q. G2 {0 R4 |
} / V8 m2 t z1 _0 O0 p
}
. a2 f2 k9 v0 n& H; ?5 I
; R# u; ^* l) Y) J8 rsimple.StartSimulation(".Models.Frame.EventController");
! X; g8 N @/ M/ u / i! O8 y+ \, u3 a" m/ D/ U/ ~
if (simple.IsSimulationRunning()) - M! E, ]7 A) r8 T5 x7 A% f
WScript.Echo("Simulation is running!"); 0 P0 O7 Z2 i& b- q1 D. G1 ^
B3 v1 P7 Q5 r* M
// Wait until simulation is finished
. U4 n" U8 ~4 `while (!Finished) WScript.Sleep(2000); , V8 z( f6 M! `- K% i# k
0 O( y- ]. X$ a5 Z. ]. `* c
simple.CloseModel(); ( w# u0 e6 o6 b# y; r Q
simple.Quit(); 0 m. ]7 R9 H3 [2 H- g
WScript.Quit();
! _' _9 o, G7 \7 D8 C1 s# ~$ z
0 t3 q6 p0 B) C4 k9 f 5 O6 G7 _- h* H0 k2 p
function RemoteControl_SimulationFinished() 6 h; f& ~' ~5 u- L
{
% t! m E: Q3 C& C* t WScript.Echo("Simulation Finished!"); |