Example of a JScript ; n) Y9 c& ^* Y- o5 W5 l% K
var vbOKCancel = 1;
0 d3 S) G9 u# zvar vbCancel = 2; / p* H: K k6 o+ ? o
var vbInformation = 64; % K+ P" _; h% t/ l* V
var Finished=false;
$ s# D5 q# R' w
! Q8 |7 }% e2 Q# ?2 `var WSHShell = new ActiveXObject("WScript.Shell"); 2 l7 S* c8 j$ x/ `" P
1 r3 H2 _9 E: G& B1 Y6 Y$ Zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 p( ~, `: k$ `* U! x! ]
+ D8 ^. f9 q4 p% `0 }% ^
simple.SetLicenseType("Runtime"); % g; ^/ I4 Q, A# h) `
3 F8 s- X+ t1 Z4 b( f6 e: _3 z
try 8 k3 P8 H! D. H0 w: y
{ 5 h' h* P& ?* o+ i% i0 u
// Enter the path to a model file! , `. y% P% l6 Y$ `5 D5 z7 m
simple.LoadModel("C:\\Models\\Test.spp"); 3 a$ Z/ g! V+ t2 j3 ?7 @" Z
} . W$ j% j: q! u* H9 ]
catch (e)
- \ z) M O+ n: K6 q{ 2 z* Y6 m8 q# H$ s# B: c9 a' |
WScript.Echo("Could not load Model!"); ! E( L0 z- c; g! ]1 g9 X
WScript.Quit();
$ ~' J7 n* R# j4 L1 z3 [0 I}
5 r) m0 v& l# R9 g. Z/ F* B * b8 V: [+ _; {0 L# m4 M1 L
try & p- g" r0 g3 C$ K8 _$ W
{
, t# f) ~6 Y. |9 ?& `' B; h simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # N$ b( Q2 N. P7 a Q x9 ?* ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 _7 r2 F; T4 `
if (r == vbCancel)
/ S9 A3 Q v; ~' e# _6 K4 h: l0 r+ p { 3 ]4 a4 b3 I0 l' W( l2 A
simple.CloseModel(); & m7 W$ C" R3 [* N. l' a4 D
WScript.Quit();
+ z- [1 s4 _8 c* X. U } + X. Y4 | ?& O; t; q. }& c. h9 Q
} ; W9 Q% g, T3 w$ T8 Y
' p+ l- |! o! }( k* K0 K, K9 L
simple.StartSimulation(".Models.Frame.EventController"); $ {0 I P9 d# D* D! |9 [
* z. a# S; z- _( N# kif (simple.IsSimulationRunning()) " R9 N+ s! \7 ]9 |4 F4 J0 e
WScript.Echo("Simulation is running!");
* ?" W; p! u6 H5 w5 U( a * x+ t7 d6 j4 h3 O0 r/ r8 \9 ], |
// Wait until simulation is finished
" J) A; n% @) bwhile (!Finished) WScript.Sleep(2000); - P; [( S% h% ^
4 u$ U- ]* l# [1 `) _simple.CloseModel();
' U* D* L _1 }" b S3 a2 e* \) @$ zsimple.Quit();
, n5 ]! I8 F7 C( l& J# x& m( `WScript.Quit();
( g8 Q5 X" T, r! F/ ~' X / r) V3 @, _# {8 @% e( i
' @" X+ H0 ~, Vfunction RemoteControl_SimulationFinished() ! i) q. w' x( C; o; `; @
{
! d0 k; N1 p3 K- f* |9 ~ WScript.Echo("Simulation Finished!"); |