Example of a JScript ) k. y% X4 j# U& Y5 l
var vbOKCancel = 1;
- }% O3 C8 F3 {, M: o6 nvar vbCancel = 2; ; _) F l7 a, N0 a; p
var vbInformation = 64; . r, D0 n& f) ?/ ~( ^: o. {8 `
var Finished=false; 0 m* v1 r6 m, K: B3 E6 m
7 {5 U3 _ e5 r& m1 |5 U& Zvar WSHShell = new ActiveXObject("WScript.Shell");
/ R3 U0 e1 y+ A, _
P1 U. g. F9 ?* ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + `% F0 y& j' i# {8 h7 c( |
) K2 j) D5 h8 W. L* r& Rsimple.SetLicenseType("Runtime"); " z$ S5 s- O( ]5 K. h9 t) S
, f" N7 I# p' |7 P7 p3 B, ntry ( W6 X6 t- Q; u% ^5 h* D8 X
{
, z0 Q. m( S8 |& u2 n7 S; v // Enter the path to a model file! 6 V5 p6 V/ G; m" x7 B
simple.LoadModel("C:\\Models\\Test.spp");
8 k1 B# A G7 o; w) |5 q} $ o. ]/ U, |4 G6 B+ V+ g8 y0 W
catch (e)
5 {8 [6 m' g% O% y- S{ * o! _) ^. \! Y) o( _+ N6 b
WScript.Echo("Could not load Model!");
; n6 p9 s( a6 f% P: v; D& J WScript.Quit(); % y* l; r9 X6 s* J* C6 U
}
& j( }1 \0 c2 L$ C1 s+ ^
4 g7 R" c! N8 u# wtry
6 T7 K2 ^2 h# y- N: V{
1 F0 L6 ~# L2 w+ e: ?/ c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 D9 H" M2 X- K0 f0 O! Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' A1 |! R' D& x9 n+ c7 G if (r == vbCancel) ( {7 j; @2 X! e) N' [
{
2 Y9 [1 P, i1 G6 R5 \; S' ~ simple.CloseModel();
9 M8 N2 s5 p! Z WScript.Quit(); ; e1 B I6 a, L& W, }4 l' B6 m, k
} ' q. Z! w$ T8 o- P; U# C! ]
} - M7 M( S' e% {+ T+ u7 z
2 f/ J2 ~! l( fsimple.StartSimulation(".Models.Frame.EventController"); + J, h: i% ]- q5 n
4 O' d# {* x( x4 j! L& G5 V6 cif (simple.IsSimulationRunning())
! e! J) ~; {/ A* b/ w WScript.Echo("Simulation is running!"); + g) j( [5 Y/ ^: L0 h
/ [# b' P' T; q- P// Wait until simulation is finished " Q# D' n% l( {$ l
while (!Finished) WScript.Sleep(2000); " r$ h# Y6 e- U9 ^2 i6 k" m4 o7 Q! v% \
( k" D4 [) T+ M3 q" G9 q
simple.CloseModel();
4 H% m) Y2 u {4 \( Isimple.Quit(); ! p4 c+ h' m- F, _( o
WScript.Quit();
8 ~/ [! b$ L: ?5 `3 J% c 8 X# X: V$ T2 e2 L" G K$ L. r2 w( X! _
) t2 n$ k% o" i
function RemoteControl_SimulationFinished() ! X: f: t0 r' I5 ^. z; c
{ , ]4 `& K: h4 ~( K
WScript.Echo("Simulation Finished!"); |