Example of a JScript % m6 V6 f3 q0 y, X
var vbOKCancel = 1; 2 k/ J, f U0 g
var vbCancel = 2;
$ m3 } P0 ?/ W4 p- ^$ Q: lvar vbInformation = 64; 5 |2 D3 [$ `" A' R7 i O' V
var Finished=false; - n$ B, A$ J4 o# ]4 [/ [" {' T7 M! B
# K `6 g+ C! }* m' R" o' w
var WSHShell = new ActiveXObject("WScript.Shell");
2 c6 C6 m ~7 O9 @/ D; w7 Z
; g+ ]: y- E( Z6 P. ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, C$ J1 R" h; \# Q
2 Y5 s8 h0 @+ g* X8 q" T) ]9 J1 msimple.SetLicenseType("Runtime"); ( S5 t4 w2 C4 I. t6 x
' \" J+ o. S/ i, h( ~0 ctry , y! B* w0 G$ q' E' M
{
. j: a8 _, g3 G) O; V9 q // Enter the path to a model file! 2 C. M) A; u4 O2 H4 W' g+ Y
simple.LoadModel("C:\\Models\\Test.spp");
7 X# Q: R% V5 s2 S- B3 A}
8 X5 F, e/ l/ t+ q( m, [. Bcatch (e)
M) B# K/ S* s+ o{ ! w; z7 O0 F7 @) V1 {" T) s
WScript.Echo("Could not load Model!");
: c2 n4 o& O! f WScript.Quit();
% I* }5 Q0 F5 u( V. ^" E}
- j' |% Z3 Q( _ O" x
1 k# G3 S: L' E2 }# r6 utry
! l) [( o, i/ b9 }6 w9 y" x{
) I- q; Q$ w' V' w' I7 F0 d; ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / k3 U' U. S4 ]4 v9 F+ v% ]& I
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 k3 U0 W0 g/ l$ R- G+ m
if (r == vbCancel)
1 R6 C8 K* B& {' j ?! j2 D2 n { 1 V! X+ _ ~8 N
simple.CloseModel(); 3 y' |! |( g7 @+ ^) L. T( |
WScript.Quit();
. u0 u3 }( ^ c* ~6 Y4 e. s }
7 r9 _( H5 U3 a. b& s5 s} $ ]# k* v* t+ a" ^! p! }% c
. Z1 h: V6 ]3 x. c
simple.StartSimulation(".Models.Frame.EventController"); $ e8 Z/ p/ _% W- L5 p W
* n( r, K4 b Q% H8 g% \if (simple.IsSimulationRunning())
9 ^+ t. o- J( l WScript.Echo("Simulation is running!"); # q1 b# z5 |* b c# l, T% Z/ w7 h1 b2 {
$ _* M$ Q: Z, @% D' P4 w
// Wait until simulation is finished $ J9 d. A1 ?7 j: M: C' C
while (!Finished) WScript.Sleep(2000);
/ Y* v8 e2 @& I: R9 p0 ]9 b9 B0 p # u1 I4 e* c; u
simple.CloseModel(); 4 ]5 q9 {2 p8 B2 U
simple.Quit(); 4 q. _( |8 T5 K; k. v& O
WScript.Quit(); v1 Q3 S# g: m% c3 S4 X2 F; s
, y/ C3 y2 c& t7 W: T
& f' K! X6 Y) ~# } k0 |/ X$ Yfunction RemoteControl_SimulationFinished()
+ X: I* s% z% G% B3 } A{ ' _5 _; v, ^: E! |; u' W3 v
WScript.Echo("Simulation Finished!"); |