Example of a JScript
& @* `$ z6 I f' t. Avar vbOKCancel = 1;
' _( T" J7 O" G T- n ^* Vvar vbCancel = 2; 3 w f# g* O- |7 @( ]0 Y
var vbInformation = 64;
. d7 y t6 M% K$ I9 r& p$ Bvar Finished=false;
5 c5 Z! k# P0 r: w' G9 ] 5 W6 L( p! [2 f% t" V
var WSHShell = new ActiveXObject("WScript.Shell"); ( {0 Z+ _) t$ i3 H6 C) J- z
1 ?- z- J+ e/ l9 u
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& L) `3 }% x G, v9 ~
7 B: m5 r* g; X! ]4 D2 U3 C& o$ Jsimple.SetLicenseType("Runtime"); 2 \9 L% [( x! Y b
9 R& a. y& S% K4 w- P) @
try 5 r! i/ m, R6 }- h+ x& L2 x$ ^
{
' ?$ _# H1 H3 O1 B! N! o5 m // Enter the path to a model file!
8 E, u! z9 B, Q simple.LoadModel("C:\\Models\\Test.spp");
! G5 V9 h7 G i I! x. P3 x; o( T& W}
* {3 ] m$ S5 f n" i, D& ]catch (e) 1 |, [6 Z- Q% Q3 z
{ - E7 H, ]) g3 b$ p7 T- e
WScript.Echo("Could not load Model!"); ) t5 D/ m) V# m) [. R. {
WScript.Quit(); 2 p. Z2 D Y/ v+ X
} % s$ v5 v, a5 _1 A( ]7 ^
: ]9 }" y% b* e0 U+ D# r" j6 a) `
try 8 z( V( d" m% _1 q) O
{ ( \4 b" b K* W9 ?/ x5 P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * e' ?9 h A1 G& F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , n: C" e# q6 G9 [: Y
if (r == vbCancel) 4 z2 A5 _ u- h7 t! b* P" {7 Z" s, \
{ + j6 Y+ Y2 W! a) J x! o
simple.CloseModel();
; R, |" c! n5 J8 \" z& Y" ] WScript.Quit(); 0 u/ j. K/ `/ G7 z7 w
} 7 V$ `: E6 n. C1 f) Z
} 2 W# r( O# E- d& h! P
. T/ R/ j, X) d# H7 Qsimple.StartSimulation(".Models.Frame.EventController");
* |, p; K7 _' i 9 C) j: O, l2 |; [) q
if (simple.IsSimulationRunning())
( ?6 h" ]* \, F WScript.Echo("Simulation is running!");
3 ]9 e# c% O) S * @6 b. o' ^! a' |5 c5 W# N
// Wait until simulation is finished 9 \/ E- R( Y7 r+ [& X1 r( e8 x8 _
while (!Finished) WScript.Sleep(2000); 8 I8 M; S F. e' G5 S
h8 k6 l( n/ |) |8 J4 asimple.CloseModel(); 5 H4 r- q+ N3 \0 ?! V
simple.Quit();
( ?: {1 n! l) M' A- v% h/ b, ?+ ZWScript.Quit(); ( i% @$ q! Z. M3 x& h0 [3 ?
& F; [) w1 S, f7 @5 v
' k& q& I9 }& Q; x0 Gfunction RemoteControl_SimulationFinished()
' H G2 p2 l7 w7 f" E9 r{
, X$ N$ M3 p) w$ n5 { WScript.Echo("Simulation Finished!"); |