Example of a JScript 7 ?) W; z4 r8 |6 s2 q
var vbOKCancel = 1;
, j# \ R6 m! `; ?) D2 ^var vbCancel = 2;
$ g- q1 u+ D' r$ |* l0 ~, _8 ]% Evar vbInformation = 64;
3 T5 y+ C* K2 I& @* _var Finished=false;
9 M$ a& F& X! W ) X: ^& R# B# i+ F
var WSHShell = new ActiveXObject("WScript.Shell"); 5 `6 @; ]5 G) j8 U
& P; v& ^! s9 X( p3 Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( E9 h* u/ D# n" p$ |& O
$ R5 W) J- w1 C# I! f& bsimple.SetLicenseType("Runtime"); $ Y$ Q- ?& o0 q" e5 T$ e
; d/ Z- h2 M. J8 Etry
* I! y+ {+ o0 _: q6 C9 z: B9 J{ + }. ?" t4 h( h1 }9 D% N5 Q# e
// Enter the path to a model file! # U( W( }' H4 E- g7 I0 H
simple.LoadModel("C:\\Models\\Test.spp");
! _8 O" r( f5 L/ V} * R+ h# G* W9 B! j
catch (e) 5 \' ]6 n5 v& i- n
{
. ]; N( g) S, G1 y% g2 C# W WScript.Echo("Could not load Model!"); % `7 U8 ?8 a6 a. d$ m
WScript.Quit(); % o$ X: E/ _; w
} ( u) Z s* ~4 @" n R
6 |- s5 g G2 f4 ntry
& K- ^ W1 W E! `7 V{
8 H0 i& \$ V. P3 i' X8 ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- N. W" e/ g, _+ w) `8 g- P5 p r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 \/ \9 z% b6 q, |% l0 }8 x- D if (r == vbCancel)
( z4 J7 {0 @# L# k6 K' f {
- p( x0 M& u; t' r simple.CloseModel(); 2 _. w- X3 [3 k
WScript.Quit();
7 O% r8 D( Q% {+ i }
0 v0 [) `# Z- g- B1 d, q J+ V} ( i! B9 h0 c: O1 `# P7 ]
( L- e/ [* ]' w
simple.StartSimulation(".Models.Frame.EventController");
, ]! d w+ \$ ^ @, e) G9 e
0 d: x% v- x0 K+ s6 pif (simple.IsSimulationRunning()) ( J& Z1 b" @7 M( Y. g0 Z' \ {
WScript.Echo("Simulation is running!"); ! ?( @9 `6 E9 Z% i* ?
5 o; V8 ~. ?; r* [9 q0 O// Wait until simulation is finished 9 ]- ~5 y& x0 D" s- \6 d) U2 ^
while (!Finished) WScript.Sleep(2000); J5 s p3 [8 o- S- X
% N( {) w% h' ~2 T K" Z% _
simple.CloseModel();
2 e9 @0 j" [! @/ q; _2 ~' q/ c* d5 Dsimple.Quit(); ^2 k* f0 U' S. W
WScript.Quit();
7 u) }/ E/ i9 z 7 \/ J8 G4 k4 o: F* Q1 `
' z" Y b# s! C) o4 e" Ffunction RemoteControl_SimulationFinished() 3 |8 ?8 g! F$ X! q% Q5 d
{ % B# U) a* m/ r5 _
WScript.Echo("Simulation Finished!"); |