Example of a JScript % f# M+ W/ A% J; F% c6 m
var vbOKCancel = 1; 7 y! U( J! I( p; z4 m* A* p
var vbCancel = 2; # i! ?) z7 _/ N
var vbInformation = 64; " l, m7 a0 E( ~: t6 V
var Finished=false; 5 ~& S1 R+ \2 P
& ^& P6 A8 g) e, v8 f0 T1 nvar WSHShell = new ActiveXObject("WScript.Shell"); 0 ^" k/ h0 W& L/ y3 ]. ~
- \7 ?! @& }2 @7 d2 H! G7 p9 Bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ e% k) A2 @1 V, i3 o; [* p6 { 4 {6 x; |) _2 u! S$ }8 j
simple.SetLicenseType("Runtime"); 0 Q7 ~' d2 a* q, `/ C) f& C
# {' A6 ]# z$ w- X2 v
try / s9 U" |0 ?! z0 Y( i( I4 ~
{ % b8 @( a3 J7 G3 C& ~. l
// Enter the path to a model file!
0 l* e/ F7 [( w simple.LoadModel("C:\\Models\\Test.spp");
" w- R- g( {0 n( |! `, a. I X# v \} 2 C3 H- y2 V% c- F* W
catch (e) 8 m1 M3 X" ~, j7 {8 g" E4 f
{
2 U0 R F" R& K9 n# [0 Z/ }" |" L4 e/ a% g WScript.Echo("Could not load Model!"); # Y* ]: P0 {& {7 c- f" Y/ v
WScript.Quit();
9 A3 n( N Z! O% {9 |& C6 @$ j}
% k9 W9 D: H- X2 U: ]6 d
) \$ j. K. g& M$ _9 Htry 0 r& l" r0 L+ f! L' i
{ 4 u4 L2 G6 T( _1 _' J$ z' j
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, P% s; E" _0 G0 Z" \+ b r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& n: @) x9 L1 p: G9 A: ? if (r == vbCancel)
% u+ F9 j1 j1 { { : s. C& c: [# `$ q' Y) S
simple.CloseModel();
_ X& Y1 g% \) S1 u+ } WScript.Quit(); 7 g( L% W' {- d5 R
}
, D! Q3 k A5 b6 p}
4 N2 E% e. F+ W . h5 c! G8 J5 V
simple.StartSimulation(".Models.Frame.EventController");
$ _2 i, M! L7 u4 ` A0 Z5 g. a: | $ m: ^5 {4 ^' s5 }
if (simple.IsSimulationRunning()) * N+ U* X2 H7 J
WScript.Echo("Simulation is running!"); `3 n0 g, d& l
2 U# O; U; a6 Y/ i, d, R" h7 i7 D
// Wait until simulation is finished " y/ w* q4 T0 B- Z2 x
while (!Finished) WScript.Sleep(2000);
. C% w3 T) f8 c3 w* c9 O6 I
# D% W3 w' v( ?2 Qsimple.CloseModel(); 9 p' ~/ O" c. t- _% j8 q! z) U
simple.Quit();
/ K4 ~; s8 D8 t! rWScript.Quit();
& _5 ?* N: U3 ^ 9 B: P3 |4 R: D$ A, n# f6 f
* I. P2 P2 H0 t9 |function RemoteControl_SimulationFinished() 6 }7 N" z6 ]* b z7 _/ x/ p5 N6 v+ ~
{ " {' E# L9 W8 k7 l. y: s
WScript.Echo("Simulation Finished!"); |