Example of a JScript * @9 l3 t# ^1 u1 p+ I% Z7 s
var vbOKCancel = 1; 7 J/ j! l6 g1 u, U) T: G
var vbCancel = 2; " k4 A+ f! J/ Q% ?. E7 @
var vbInformation = 64;
: i! {1 B x/ J; ^6 Uvar Finished=false;
$ i) s, h( v2 k" S " l$ @ U5 g0 P. S* h+ f
var WSHShell = new ActiveXObject("WScript.Shell"); - b, C& o7 P+ I! d3 \/ J' g- q
4 q) g1 V( J5 evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 r( Q1 v/ F6 f) F" I; {3 c! N
& B; ^* F7 B. N* g/ e
simple.SetLicenseType("Runtime");
1 I0 ~2 p7 B9 ` T
: }8 t! Y' A, Z/ Y dtry 0 c0 U* W/ G2 w3 k
{
8 v2 I# }6 z+ C- Q. F$ B9 { // Enter the path to a model file!
: V6 m' H' G6 K simple.LoadModel("C:\\Models\\Test.spp");
% }( j' u* P" ?}
7 i# O0 M% _7 Q$ T1 D5 T2 tcatch (e) 9 E2 k# `' Q# ]' y3 u K
{
) B1 d, a- `( F( Q9 E$ P WScript.Echo("Could not load Model!"); . Z1 l- J' a9 |6 ?7 ?
WScript.Quit();
& y' E2 ^& G! @! j& G} 3 x1 h6 Y1 j# [- t0 O8 i1 [
4 S2 m2 r, c9 e7 ^4 Z. p! ]
try 7 [7 a) ^+ y9 y' A% w
{ 6 {& P0 k/ R! j9 G2 @6 D: a
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + r% X2 i& m+ D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 K7 ]* s! h2 v& q if (r == vbCancel) k5 F* d7 Z* g0 z
{
4 C- S) U/ E, q4 R) g simple.CloseModel(); u/ z4 q: v; D
WScript.Quit(); 1 k# ?0 b" q# h! s8 l2 h1 ^
}
! O! e+ T2 _9 n$ ?6 B h} + N% R7 H" H/ _4 e- y9 p6 h$ _
+ L7 g: L2 K; Z/ e* |; n( l; wsimple.StartSimulation(".Models.Frame.EventController"); 4 n, f3 A" D; d$ F- b
& x" C4 L9 E8 E5 U7 L% n3 y
if (simple.IsSimulationRunning())
* M% ^1 N! ~$ S! v WScript.Echo("Simulation is running!"); * f! O# Y: b" S- ~
/ \/ B; n; W' `/ S3 d$ o u% i* t// Wait until simulation is finished 2 J! M' }: S8 z5 } J" u2 s9 C
while (!Finished) WScript.Sleep(2000); 4 n' w9 ^, q: x y/ w) G
' l8 p0 Y' L5 | U
simple.CloseModel(); 1 ]! c: }$ w- c: g+ L' Q6 r
simple.Quit(); , f+ K. g4 O5 r4 o
WScript.Quit();
+ J. ], r' K! H2 X( K ' {' [: r ^7 i2 ~# G' ~5 @9 \
: B) b; a9 c8 N# [7 c5 V# sfunction RemoteControl_SimulationFinished()
8 C% |9 u Y7 y- e{ ; Z! o* N$ [5 ]! ]$ n- M" |/ Y
WScript.Echo("Simulation Finished!"); |