Example of a JScript , p6 m) T6 t4 V6 {
var vbOKCancel = 1;
+ ?$ j: s6 j* c4 u% H1 l! {# d. hvar vbCancel = 2;
+ a. n: q& k. R6 Evar vbInformation = 64; 7 y9 T0 Q* ~9 n \6 M
var Finished=false;
r. |; W4 B/ s. ], }! a
' C: F% @: L# Q2 ` S! I& tvar WSHShell = new ActiveXObject("WScript.Shell");
/ j: z# t8 Z# R8 ]7 ` 6 }0 G0 Q) Q4 T3 N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( l9 |% `* ~! X% _: Y- T
/ t$ [/ B. N$ xsimple.SetLicenseType("Runtime");
* w# d% ^' m3 ]: x
% W$ V# O3 J$ R- t5 {try
" t% k. Q* B+ n( y0 w( F1 C( Y: E{
- T2 j; F8 J0 x // Enter the path to a model file! ! m u% V5 M. S" G, D
simple.LoadModel("C:\\Models\\Test.spp"); * J1 V5 z( \4 ~* X: @2 Q, F* W
}
3 P$ w" Z$ w! ?8 w( }& ~! wcatch (e) / B6 O( N# j0 q$ C8 \# P' {! ?
{ x- [- p/ }6 n h& q: w
WScript.Echo("Could not load Model!");
5 e' q5 `* M" b1 D. @! f; O3 V3 q WScript.Quit(); 9 k# |+ q/ K; X9 g1 y2 k
} ) Z) ^% o; p! ]+ N5 [
) s! ]. [7 j) L3 rtry . r: o2 h5 V1 O
{ 2 _$ v% p! g& N) I5 d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 W$ d& i/ B! v r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 H! x. P1 m5 o/ p4 g0 e/ `) q D
if (r == vbCancel)
( w( {* t. i' f2 _7 n, Y# w; H& L { / ~' B4 o) X. r# L0 U
simple.CloseModel();
: g. S* y3 ~( z e3 j, j WScript.Quit(); & x6 e' A# [3 g$ `; L9 I$ n
}
6 P9 \0 `$ Z _0 h+ |) z6 _} % @ \7 H0 }/ b" q
( H0 p7 p" W% ~. e$ B
simple.StartSimulation(".Models.Frame.EventController"); ; J0 m6 v- f" W ^- r S
) P# I+ ~/ k s1 ?% Q+ uif (simple.IsSimulationRunning()) ) R2 Y; ]; @' `# X+ r
WScript.Echo("Simulation is running!");
T+ J7 ?9 E+ B/ n
2 M" @* Z: A7 M) r// Wait until simulation is finished % l5 @: S+ w- l5 [# `( P
while (!Finished) WScript.Sleep(2000); % z" I; H3 z7 q2 v; R, h" G
+ h2 a4 F- a2 m. Asimple.CloseModel();
% W2 Q+ m5 v+ ?' R* Jsimple.Quit();
% p, Z1 U7 |* |6 z$ J( o8 DWScript.Quit();
( n$ _3 r: z; v+ ]# y; i
, A9 z5 ?, P7 l* i ! _ f% n b6 e1 B7 E
function RemoteControl_SimulationFinished() * R; l; }( I2 e
{ # N' g: ~4 D0 Y$ P& j( O
WScript.Echo("Simulation Finished!"); |