Example of a JScript " R5 Z5 p e8 ]& n9 I
var vbOKCancel = 1;
4 h- ]- z- b1 mvar vbCancel = 2; , p: g" A, t P0 u
var vbInformation = 64;
. d4 r' ^) t9 b. x1 k/ k) xvar Finished=false;
! ]/ m8 [, L" s- t# O7 ]
" u& G: ?2 S2 U! uvar WSHShell = new ActiveXObject("WScript.Shell"); 1 H2 t6 A+ n: G4 _: [ |
: R4 s1 [! e2 E6 t1 Z5 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 [( h1 D" I" ]$ M# W& {: z
- ~2 q5 n5 a* |8 z, X/ [$ M1 A2 Csimple.SetLicenseType("Runtime"); ! O# K( b4 V" X+ _
2 i1 t9 j1 m/ j
try
2 d8 u7 D! ^& l: g& x5 d{
) s' f. o. a+ H. ~# H // Enter the path to a model file! : Y6 ^/ h0 @( W7 h% ~
simple.LoadModel("C:\\Models\\Test.spp");
" a% Y2 f2 j/ |! x} 6 k. ]4 ~+ h! d& i* {
catch (e) . v+ _* e/ z% o/ `- k8 B1 T7 N
{
4 J# z8 Y% {8 ?7 Y WScript.Echo("Could not load Model!");
; n" Y6 K, d1 ? WScript.Quit(); " }1 V1 E( N5 r+ x* K# d4 f) U
} * b: w6 G" C. c/ `* h
7 a# x& _7 u; m0 ?+ d
try
$ b0 p% ?- k+ v4 m/ |$ W{ " \; A- C( i# z1 h4 Z0 |/ d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 t# A [/ Q3 s; Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( P* E- O& a2 U! e% W, i. q if (r == vbCancel) ; t: h) P' h/ C3 P. P7 M
{ 0 k$ ]0 u8 p9 g; K1 c) g0 f
simple.CloseModel(); / H6 `$ j6 {: S7 _
WScript.Quit(); ! Z* A1 q! X" P( ?. M
}
! `# e1 ~5 I! @! t4 N} 2 h; r3 h3 f1 j) E" q1 j4 o
. o5 z7 ^6 l( F1 Vsimple.StartSimulation(".Models.Frame.EventController");
+ w' {4 B8 l& Q, o- R3 ? 6 O7 {) O9 m! v* e, \2 Q
if (simple.IsSimulationRunning())
: }! a; n( U/ t% @0 N+ n: O/ U WScript.Echo("Simulation is running!");
7 V/ |+ p2 V6 N! q
Q! `0 ^2 s; e; ]# J [# O// Wait until simulation is finished
8 T6 q2 n: Q, E- W9 Gwhile (!Finished) WScript.Sleep(2000);
$ N6 A: N& J/ F* o1 v5 E A' l$ X 1 v/ O2 p! t/ L: N% M4 X! d& Z
simple.CloseModel(); ( a' y+ g2 I- C0 w8 B, g8 T
simple.Quit();
- x4 H& [9 c+ n& s: D0 h* tWScript.Quit();
6 D1 x2 r1 a2 m+ R% r
1 A3 T3 ]% P8 |; P0 v8 q: h) u $ l. A r4 M% C/ F. A
function RemoteControl_SimulationFinished()
4 l4 r3 I& _3 s# u{
/ h) y% ?2 C. @; X WScript.Echo("Simulation Finished!"); |