Example of a JScript
6 b7 l; k: ?& P. `6 _var vbOKCancel = 1; # @% B/ ]- h4 Q# e7 o k
var vbCancel = 2; 0 k3 |2 e- Z4 b' j+ A1 E
var vbInformation = 64;
) `, J9 P& l l2 j! u% yvar Finished=false; 3 _) n4 d+ H6 X& x
& n! n% D0 ^5 x$ yvar WSHShell = new ActiveXObject("WScript.Shell"); ' r/ i# W+ `1 W+ e# t0 q2 [
0 Q! S0 u, I' x6 L. A' u3 u5 B
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . m# R& X, n _3 u8 \
/ W) O! u c) B
simple.SetLicenseType("Runtime");
2 }# N2 D: n- G! M% S( {; ^( L
# U; M, ]9 v2 `$ W6 htry , G7 c# L& w( h: B2 n
{ & S( K. t7 L) k' i" d
// Enter the path to a model file! $ L" Y8 L& e1 w4 M* T
simple.LoadModel("C:\\Models\\Test.spp"); ) c) G; [$ F. r7 Q
}
% C9 X6 F/ D# F) }+ d/ J8 ncatch (e) , e* V9 b% l7 E' S
{
7 a6 S7 B( c" T7 \+ j WScript.Echo("Could not load Model!"); 8 T4 E0 q, X* a( F: V, Y
WScript.Quit(); $ Y$ {1 z: f( }
} ! D6 Q/ e4 X) h! p3 E
0 _% c/ J$ F6 M- P* \) g
try 8 u$ B5 \" {' f* S ~
{
% G F$ F: p% D/ U7 ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % q# U- V7 \6 E6 @4 ^5 b; u8 v4 o+ c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* U) D3 S" n j if (r == vbCancel) 9 ]) u$ }* y1 l/ b x
{ 4 k9 x5 A; Z, v" M5 B
simple.CloseModel();
4 i6 a5 X. b* m2 x& M. m* b WScript.Quit();
+ Q; F% D' D6 i! K M% o; ^ }
8 L2 u$ X! K9 z2 [0 `} + e! {! u j1 l
# [: x5 ?- U) C' m
simple.StartSimulation(".Models.Frame.EventController"); , v) h( e5 U/ S# y# [$ y9 N- q# X6 o
( C4 J3 x( o) V, f, a
if (simple.IsSimulationRunning()) O5 c9 m' [" M( H) G- N- T& y
WScript.Echo("Simulation is running!");
( \. s6 T: {+ ?+ w 6 R( e: l$ V- }, y
// Wait until simulation is finished ; g% M2 [7 ^8 X1 J5 F% B" M/ ^
while (!Finished) WScript.Sleep(2000); 4 @ x8 N s, w! {7 p2 E
3 l- T" z2 A# d7 ?: G6 S$ |3 v+ j [simple.CloseModel();
; Q/ }7 @* b+ J' d! Psimple.Quit();
* P1 }- s4 i( T. AWScript.Quit();
- Z0 Q7 U9 n% t
" X0 ~5 @' @/ V! ~/ X ) y8 x) x4 h- R- W9 r
function RemoteControl_SimulationFinished()
0 R3 r+ @; _& i |3 {- B& p% _{ " o4 K: s; {4 ^: _) ~2 z
WScript.Echo("Simulation Finished!"); |