Example of a JScript
$ f( o' A( H7 f# `+ c6 |. q6 svar vbOKCancel = 1; 7 j5 b9 `5 ^! {6 l
var vbCancel = 2; " Q F! A4 x8 g% S3 T' L6 Y. ]
var vbInformation = 64;
% ~% E g/ b( x# l" F8 Y$ bvar Finished=false; 2 u9 P7 ?9 Q7 c9 k- _
% Y1 Z, V: Q8 T' h' i
var WSHShell = new ActiveXObject("WScript.Shell"); 0 U9 y9 ~+ \' M
v3 d/ b; N7 E7 n- } j7 \! H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 D1 z/ u5 v0 B5 ?" O* j
/ Z" _7 r5 j& o; K% ~
simple.SetLicenseType("Runtime"); ; U; ^7 v* [- s2 p% \7 l* M
+ K6 m$ E4 _) ?
try
( R* Y' S/ o" w% d, @0 r{ - x0 g1 ^9 G' T! C9 {# Q; B
// Enter the path to a model file! 8 F- G) L# F+ T, L4 h
simple.LoadModel("C:\\Models\\Test.spp");
! I+ Y$ q& h9 W! ^2 b! r8 y8 H}
! j/ f. V1 t" }6 d; y, L" P: Tcatch (e) ( ]: y2 \7 a% \+ H4 }, H7 s" X
{
- v1 v* c M% s% o WScript.Echo("Could not load Model!"); , H4 ~, i& I3 A9 M2 r0 ]9 F
WScript.Quit();
+ y" d3 t( a( L: W* c; O} 1 d- g4 G8 A4 |" t6 E
2 ?$ M: H' P! [: k2 X# jtry 1 F) H* A" V& p: u
{ ; U1 s; H& L4 f g
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 |0 N" E; E! z+ j9 l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) J. v8 d5 @9 t. P# J$ W" _) m if (r == vbCancel) % i6 B! ~! |) U F& H6 t% M( X
{
& a, B3 Q' ~& H1 G1 v3 |( j simple.CloseModel(); . H0 g( G- e# z4 U2 K% M& Y
WScript.Quit(); 7 Q# T" d' r; t4 Z
} ]/ ?- j" e. d- W' z
} $ u" o: c* }- G* F- a
; Z. @7 F5 |1 Jsimple.StartSimulation(".Models.Frame.EventController"); 4 [$ N5 t+ K! V- ^7 Y8 m5 z
5 V) j: N& x" u, Y3 X# W* }+ Tif (simple.IsSimulationRunning()) " c' T+ e! s0 F2 v
WScript.Echo("Simulation is running!");
0 @5 a6 L8 A$ R- V% D( ^
; ~! ]* R8 ^! z( {// Wait until simulation is finished
" n Z! E" T* X$ kwhile (!Finished) WScript.Sleep(2000);
& c' T1 Q: U! [' e7 Y' l2 s& r
# z! M0 f2 R: a" B5 j- ~simple.CloseModel(); 0 f3 \1 O$ `* t- _9 {$ A3 V
simple.Quit(); 7 g2 }' A3 c( A$ B% ~' P6 w
WScript.Quit(); ' U+ F+ ^7 a0 \, g
3 X7 n. ?; N) \& b
- o$ x( a7 m0 p# k% @5 @! Ufunction RemoteControl_SimulationFinished() $ X# |" f# L f5 x
{ 9 w; }9 e! _$ c
WScript.Echo("Simulation Finished!"); |