Example of a JScript 3 }! s! j$ S$ r; L
var vbOKCancel = 1; & S4 r5 L$ P- l
var vbCancel = 2; 1 F# L/ U8 `; {# q7 M: ^1 I0 P
var vbInformation = 64; / }6 E& u" H4 \3 i+ n
var Finished=false;
: a) z3 R6 x/ t" L/ Z( V % O5 E# Y# Q; P: Q
var WSHShell = new ActiveXObject("WScript.Shell"); ( ~* l* R g+ [- Q' B z' @- r
7 {: z- s; ^$ z' avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! f, Q% x0 I- C" O
8 y5 L7 n+ Z( P- d9 o, W
simple.SetLicenseType("Runtime");
& C3 C, Z/ K) ]" c7 T 4 R( M1 ]. A: O$ ^) I* ^8 a* d
try
) |9 q7 q3 C8 P% c8 x{
+ g6 R. K- m1 q) |$ m. { // Enter the path to a model file!
v% u0 u6 v" O2 c* I simple.LoadModel("C:\\Models\\Test.spp");
5 `. J5 j5 I+ S; `2 I/ U! `# |} # l9 {) R6 o# q3 X
catch (e)
! p7 P/ A- {8 x( A" W{ $ [1 m1 }/ S& t# w, }6 h& K. U0 Z3 o
WScript.Echo("Could not load Model!");
7 d! |% h/ M! ^. \! R WScript.Quit();
3 k0 Z7 Y0 n2 K1 E2 X} ( [6 s8 x/ @2 G2 n, l- |. d
3 O {& w% v( k* `
try , o0 d$ f+ A: K" m/ ]7 w
{ + t) v* r! p7 T& Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) c u& o: ?3 g8 N* j7 Z" f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, O. {! h% Z* P7 m8 J* m. N) O( x if (r == vbCancel)
/ R0 S; [; x* V0 O+ y0 z {
0 {# u: c+ G/ m* i' B+ P simple.CloseModel();
) q6 D' ]' A9 ` WScript.Quit();
1 M* a: w0 Y( w- C* c6 X } ) S& E- g7 O% R! c& H% F1 c a
} 5 O! \. I/ e- [# c: F( f" B
8 T7 b% I+ a' L- o ]0 csimple.StartSimulation(".Models.Frame.EventController");
/ U& |9 ]9 R/ a8 ?$ s1 G# n. y
0 J# R1 O4 F' B; u# b3 i1 T; Uif (simple.IsSimulationRunning())
9 _$ _, y+ x$ V- x' m$ e WScript.Echo("Simulation is running!"); ) s& H# o2 ?; n
5 [" ^$ ^8 k4 L4 W8 ^9 I+ J, b// Wait until simulation is finished ! n$ m5 i* @/ l! r2 {
while (!Finished) WScript.Sleep(2000); " ~' A" I8 y& j6 z
- l7 l: A$ O# f2 y* R: p# `
simple.CloseModel();
+ x. Z1 V6 n6 t7 @. vsimple.Quit();
' l S: S9 S) N- L( k* t' ~% EWScript.Quit(); 2 p5 |! F% H% `: @" z; o
y) C$ _2 a: c+ p. l f6 _ * t, C4 o$ D, {7 F" Z5 N
function RemoteControl_SimulationFinished()
- r) \7 o5 l* b( r4 ~2 ]{
1 V U6 j6 [3 T% `% X WScript.Echo("Simulation Finished!"); |