Example of a JScript
; S, F2 _0 C4 f2 a, K* L$ h1 Hvar vbOKCancel = 1;
7 p1 E/ B5 \1 E* \% Y6 A3 lvar vbCancel = 2;
. }( i% y4 x3 @4 N4 Uvar vbInformation = 64;
) `' j; p, ~, rvar Finished=false;
1 M- t, |8 i% \ 7 W* e- H% m8 A5 X
var WSHShell = new ActiveXObject("WScript.Shell");
) R4 L q) q+ [3 ]1 N6 }& u
' |% i$ p/ @* I" `/ _var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " |$ \% d8 A& B0 b; g
( K r& Z z5 J5 X4 h! f
simple.SetLicenseType("Runtime"); 0 ~+ _; |+ f" K' Y
. O2 H$ O' t5 v s# Atry
! y1 t8 l! O2 G. E. G$ \! H{ 5 S/ W* W- L N$ }
// Enter the path to a model file!
; m+ [1 K; u0 K* ?3 W* E% P4 m simple.LoadModel("C:\\Models\\Test.spp");
) |: u4 A4 M. s+ ~, ^5 h}
: ~2 G l7 A5 y9 ccatch (e) 4 C+ D W5 s" v4 h; J3 h
{ 8 E" r7 a- Y+ h& x0 u
WScript.Echo("Could not load Model!"); 9 t) d" h6 Q. r7 ~' r
WScript.Quit();
7 R* p) q+ w( q* {4 W# e} , I" q8 b* w+ H+ o: {
* W; }! ~( I, stry 4 r; K# E# b: W4 ~
{
7 y" r: C0 k- @) R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' c+ \. m9 b+ W, r4 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& y+ h$ ^( `( r# A/ E3 P- [3 z if (r == vbCancel)
! \) s1 M$ R7 d" F9 g+ u" z C {
9 g3 f; C0 t4 w, X simple.CloseModel();
# Z+ t9 `/ \$ [; O WScript.Quit();
7 e7 k3 m5 A6 s3 \! g }
# A8 Y: H3 k/ Z1 W2 }} 4 R* M. ]9 F/ k
! T3 A6 v% E# z( R8 y
simple.StartSimulation(".Models.Frame.EventController"); - I! U0 Q: G& X; J! T- s' Q0 i/ t* t
4 I# o$ W, \! c% K' v, m" Xif (simple.IsSimulationRunning())
9 G( p' o2 d( e. n) P Q WScript.Echo("Simulation is running!");
5 t0 g7 @" | M6 \6 R, g5 | 6 K2 d6 [' t8 O+ l! Z8 } n
// Wait until simulation is finished ! u% T3 w( t9 G0 S
while (!Finished) WScript.Sleep(2000);
0 b+ f: Q/ y1 K: ]( S5 Z $ E. p1 _9 D$ l# R' X, Z
simple.CloseModel(); 0 A1 x! G9 n) x) R. \' \
simple.Quit();
5 | l9 r4 c9 L0 zWScript.Quit(); 8 K* j6 d; E8 |/ E/ T
A2 |1 \. V! I6 L; ?
5 c1 @2 K4 C6 a9 ?" c9 y ufunction RemoteControl_SimulationFinished()
4 J1 G* J6 E9 D+ S- @( e# e4 ?{ ! `9 q6 u z, v" E4 m9 \" q
WScript.Echo("Simulation Finished!"); |