Example of a JScript
5 C$ ?5 O: D4 ^, Z% Evar vbOKCancel = 1; % X. C4 i' Z; Z- K% F; e' [: B
var vbCancel = 2; : {( t7 }, S1 E D+ x- N4 X7 k$ I
var vbInformation = 64; ) Z" \3 ]# O+ ^) U8 w2 g! K
var Finished=false; 8 ]& i6 H( q0 D3 C
0 Z& G R, g9 c7 G: \ nvar WSHShell = new ActiveXObject("WScript.Shell");
# P: e5 f7 b2 W, j0 E+ m) p
3 [) \9 d* Z! I- ]0 d A* Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
P+ T" `1 n2 c8 W S6 E Q9 [$ j/ y3 Z' f# \# o$ ~
simple.SetLicenseType("Runtime");
6 ~* D A! U6 z" P; m% _ 7 q0 I2 j; L" h0 W
try ; H* w) E8 I9 N! E2 u0 Q- w
{
1 \& R& P2 h9 D1 q, M // Enter the path to a model file!
& M! }6 e& _7 `& l6 | simple.LoadModel("C:\\Models\\Test.spp"); + n2 u$ l8 w+ e+ j' U
} 6 i. u* u/ J! Z* B. @2 _! D
catch (e) - [4 L- ~/ N8 Q: s% N, P
{
6 `3 w; c; Q/ s! g4 S! i WScript.Echo("Could not load Model!"); 4 N2 ?0 [, i; H
WScript.Quit(); 1 ]% o; C& x: m, F
} ; i" P) s j, ]" U; M" R# w
4 d3 z& M( A8 P( H) J1 |try / F, U& W% p2 v ~% N8 X; _- p
{ . D: q: _: ?0 [. L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! q9 V0 u6 J; _4 {+ q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 ^( X5 i% L# j1 {. c if (r == vbCancel)
0 |, g% N6 ~9 U) C' m {
2 d. u# ~ h3 i6 j7 H simple.CloseModel(); 1 r+ s6 Z1 H$ x! s* {, M; V
WScript.Quit();
) N/ P# G- c% d. Z# D# K, J& } }
$ G; R. N4 G. ^3 m4 L1 K: |}
9 p6 u( g( r: D* d % N2 m7 I6 C E+ I8 }' s9 r
simple.StartSimulation(".Models.Frame.EventController");
. A3 e# {: L/ u) g" k, l( s9 t# V
7 j. V- x( |. e1 r* ~& zif (simple.IsSimulationRunning())
% Z5 W! Y" p H e WScript.Echo("Simulation is running!");
& E0 R/ l; y9 Z+ S5 f! z
, Q7 q# G2 M/ `% ~( L$ ~4 q// Wait until simulation is finished & H1 N3 Z5 ?8 s/ B0 f
while (!Finished) WScript.Sleep(2000);
5 ], i. h# d& q5 ^( t
3 _& z* U) K( @1 l; w2 hsimple.CloseModel(); * @ B# i( H3 {0 n3 B f% A
simple.Quit(); ; D0 W( p; w( K1 I! t
WScript.Quit();
# U1 o, B! ~1 p! Q
: f! C- u4 \0 \2 B, F# s O( d5 a 7 u$ X5 T. i$ W( T U3 Q- _" w/ c
function RemoteControl_SimulationFinished() 9 Y2 A1 `, Q4 @3 z+ N3 P
{ 3 T! U, L& F5 {
WScript.Echo("Simulation Finished!"); |