Example of a JScript
* R* w* J6 }6 h) f( Jvar vbOKCancel = 1; 2 }0 X$ C) A9 ` {3 ^* E
var vbCancel = 2;
( N3 O, X" x2 @7 \6 l2 r4 u! Y. e' q0 |var vbInformation = 64;
+ Z ~* C" g8 T, h4 U+ Pvar Finished=false; 0 H* O7 _- O0 B& h; X1 n, i, f
5 W2 C. [* x$ `. }
var WSHShell = new ActiveXObject("WScript.Shell");
. j6 J; b5 i4 r) _/ `8 Q
0 z& z" t2 o( Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * x2 [$ Z, Y: Q* } \
# b# k6 L- v# X& G! f' I
simple.SetLicenseType("Runtime");
% `+ `0 Z, b; K+ h" { + j' n' h# a- ~) y7 x7 C( O
try ! l9 t: f& X" j* ]" b- C
{
/ i2 w% R7 N2 z/ e // Enter the path to a model file!
$ n, i( Y% [3 o+ A5 @) h simple.LoadModel("C:\\Models\\Test.spp");
6 c( E+ u; Z' a4 C% Z} % h3 Z, v- ?# J2 C7 v1 h
catch (e)
9 d( P) y- F. i9 f4 |; ~ L{
o+ y9 j9 Q9 E+ o- W- K WScript.Echo("Could not load Model!");
# u, k; A a! `* H" I WScript.Quit(); & S' [6 t4 g) A; t
} ) ` T. y) A" l8 X+ j# t
. V) ?. j% O _3 d1 V, e
try
+ k" q7 z; i, j; V& y, A{
* _: e* g0 h- p3 ]: ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! }0 N0 p9 j4 i: h7 @7 ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 _: m- g: m* c- G- O" V; q
if (r == vbCancel)
, n3 q# y$ \" H3 C' q {
4 y8 i) j8 C. J1 `) b simple.CloseModel();
( d+ P% E+ @+ \4 i WScript.Quit(); 1 m! i, g2 B$ L G
}
) T1 Z, M0 K; z1 z} - F+ M+ ^* S1 ~. g0 ^
; l* ]4 J R7 ], V+ s% E7 R: P' w- H' }0 Vsimple.StartSimulation(".Models.Frame.EventController"); $ j+ |* L3 G# q% @3 s3 \; L
' P+ d# R: M. R( Q% s# Mif (simple.IsSimulationRunning())
2 d' R4 a, H1 x, w5 u7 J# Y WScript.Echo("Simulation is running!");
4 ? r' w3 m; f1 | 0 i$ Z5 Q! @2 c
// Wait until simulation is finished
5 x% v/ o0 K5 n8 _& G' T& Ywhile (!Finished) WScript.Sleep(2000); ; o2 s9 z$ U. P1 K" _% _" s3 T! m
* t5 d# N; B) ~& I7 M+ { U
simple.CloseModel(); * `' Q* _3 ]+ \! i( G, I0 n3 }9 b
simple.Quit(); " f3 L. e' M, K5 c6 l
WScript.Quit();
3 J1 e, B: H" T) w( N
* [3 J9 [, |2 c9 s/ u ( o' S7 {' q% l9 m) Z7 x4 ~
function RemoteControl_SimulationFinished() ) m# e, x7 i; p
{
5 T1 p4 }; M4 A I3 }9 _' S: P1 S WScript.Echo("Simulation Finished!"); |