Example of a JScript
) `5 ] N9 K( x/ M( fvar vbOKCancel = 1;
7 i( q9 X( }4 W( e% i; _8 c3 @% F: [var vbCancel = 2; / k3 c/ e# |% p' S$ b. c* q9 Z
var vbInformation = 64; ' w- J& \4 e; ^* z' G
var Finished=false;
6 `9 _3 A$ R7 U+ l- \
V- |; p) @5 Z$ a3 T: Y; m! v3 q$ hvar WSHShell = new ActiveXObject("WScript.Shell"); 9 e1 V& u+ i( l2 T
* _( z) z8 f5 z/ l7 p/ G3 Hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) c" ^9 H8 j4 F. w, _4 W. t; F
z$ ]/ Y5 ]" t% Vsimple.SetLicenseType("Runtime");
1 a6 n5 t, y. h3 x+ w 3 w2 t) a- ^+ p, }# R
try ' n. d0 i @% S0 ^
{ 4 P. F% }$ ^# o# k% m- |5 {
// Enter the path to a model file! 0 d" `- g) O; X# f' m+ @
simple.LoadModel("C:\\Models\\Test.spp");
/ f* m$ z2 Q. C$ @}
; {' @& N! t9 r. f* Fcatch (e) # i5 ^# t9 F6 ]) Q- w
{
& K6 X' S) E6 U( S WScript.Echo("Could not load Model!"); , T2 [ _8 w* L' J
WScript.Quit(); 1 @: y( J" P4 H, k
} / Z5 f" M' h9 `0 T( [! @ f
% i, \; K+ [) {1 U9 _try ' K6 o! K1 u; A3 G* X
{
1 D& O/ M, q" b- R' ^6 c: W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ r; a$ z+ k% @2 a1 D% w' f, K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( {6 m0 W* k& {+ H g3 ~/ R if (r == vbCancel)
& w& r/ E1 I' N1 X7 j { - F& t3 E1 @. J, K! b/ t
simple.CloseModel();
* \$ [/ _! L$ [9 p4 W) ? WScript.Quit();
. S0 n \4 n5 ]/ `& }6 q } 1 r# d$ u6 P. a! @
} 2 q* ^" @) x1 |4 _7 y# ?9 C1 i
; { k R G, D# a
simple.StartSimulation(".Models.Frame.EventController"); 6 Y4 E7 k) M* j7 O6 {: }6 b( p; o
3 f5 ~' p1 @ ?if (simple.IsSimulationRunning())
( J: o* l( B+ W) w' n WScript.Echo("Simulation is running!"); - m% U/ I9 J$ y% @4 a
+ G7 g- m& ~ _8 F// Wait until simulation is finished 1 \7 o9 M% J, { ]# O
while (!Finished) WScript.Sleep(2000);
, d, q$ f7 k* p 5 R( r4 r% o! q( y
simple.CloseModel(); , p5 U1 B: m1 t
simple.Quit(); 5 c% @9 ~" z1 {: H. P5 i% z
WScript.Quit();
C. C6 J z: K8 j- X2 t 0 G6 {$ e5 ?2 u) M8 j$ c$ L
6 D, F0 _, B/ @* |" e5 q
function RemoteControl_SimulationFinished()
/ i! k% G# l1 {1 J6 Q+ ?{
) m, B; I; D Y WScript.Echo("Simulation Finished!"); |