Example of a JScript
! B" d9 N+ z% q5 f& cvar vbOKCancel = 1;
4 ^+ l, i; P- V; O0 ^2 p, z& _var vbCancel = 2; & n: q! o! V8 C- a% g0 n) y
var vbInformation = 64;
3 \8 H) f5 S& t) u a% q$ qvar Finished=false;
; }2 D9 C$ C: m, V8 R" x; s 9 L" @! t6 D2 d/ i! `2 `
var WSHShell = new ActiveXObject("WScript.Shell");
# }5 A7 k5 N2 q6 V / s. |% k6 K: ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 L2 `$ ]" ?, a2 E7 e8 B$ r/ z. @
0 l7 x% ^2 n( w7 w# z; ]8 Ysimple.SetLicenseType("Runtime");
" H7 Q1 L: s3 R9 d
) y' e, S& j1 ^1 B/ p- P9 Stry
7 K3 x+ |1 G# i5 _{
4 L- k G' E; d! S% d! L // Enter the path to a model file!
0 w! _) c4 r; @ simple.LoadModel("C:\\Models\\Test.spp");
+ P W. ~9 z4 ?+ d} ! i. S0 c4 S5 m' I, w7 e* \
catch (e) 2 t0 m/ L: D8 I. h6 _5 U" t& \' c
{ 5 V# I. c6 t, q$ _( J
WScript.Echo("Could not load Model!"); . x5 o( X+ u& ^# P; [) H0 ~
WScript.Quit();
1 `4 Z6 d6 y1 R+ l. ~, k' a, s% g} 6 B& D% k0 J7 R. K* a; P
' x4 O& b0 F/ u$ k `3 N: ytry
' ~ T2 z3 H2 K! C( q0 T{ 3 e. g |* X3 F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) O( _) ^8 N# |
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 k K7 B2 ~6 F1 } if (r == vbCancel) 6 e* I7 [% }0 m2 A% L* ~" y) [
{
4 |6 ]* l1 G0 R3 G( {4 [ simple.CloseModel(); ( b/ V, M. T, n& W
WScript.Quit(); # d" V& Q3 {5 R7 \( R3 [3 @' A! P
}
, m; f" Y5 J) }" n, G}
; x' x4 n) `. y
% [' k9 V1 B- G3 _' k( jsimple.StartSimulation(".Models.Frame.EventController");
# i& x; M5 P+ D
7 L/ {& B- G/ [9 k. Rif (simple.IsSimulationRunning()) : {" ~# c7 T H- G t
WScript.Echo("Simulation is running!");
( F/ E% a! s w q2 ?% n6 ~
7 r6 v+ z( J/ |// Wait until simulation is finished |% G& P$ a) I: X7 W- w
while (!Finished) WScript.Sleep(2000); * v9 ~+ A( O+ c y
* q* w! Z) p5 d& P" vsimple.CloseModel(); 2 X0 X. W, h( G3 O& b" Z
simple.Quit();
8 T: z: Y! I. E# H4 O) x1 [WScript.Quit(); 3 w. a" }0 M. w! O# x5 I9 f7 o# y- L
: c# p: y8 {& d! r 3 M9 d$ J Q; Z5 _5 u W5 p
function RemoteControl_SimulationFinished()
7 S: h5 ?& _. t( f" g1 \" w$ I{
* }5 A+ j' B, ~* ^/ | WScript.Echo("Simulation Finished!"); |