Example of a JScript
% S! ~6 V9 U0 j: M, A: g- o5 Nvar vbOKCancel = 1; & e5 K' l* J$ F2 q' t& ~! Z( |( e/ m. x
var vbCancel = 2;
x% O1 K i) h3 F4 _5 p/ O2 yvar vbInformation = 64;
" G8 G) G" e& lvar Finished=false;
- Q7 U* u6 O& t8 o' ` 9 x6 E9 S, p" }) `0 G
var WSHShell = new ActiveXObject("WScript.Shell");
! N5 z3 {9 L/ [( l% Y5 D+ Y
5 y; }2 z6 ?! J+ B% ]# S$ c& r; |, }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * g: f/ f' g; s' }( i
7 ~8 m1 [. G! ?( H; s6 v a0 usimple.SetLicenseType("Runtime"); ; k1 F' z" y. C/ p& u* E/ [3 }! V
/ ^4 |5 K5 M3 ] l# v. v! {
try
' |- }# m+ [7 P" L p1 b: K{
; e' r" @8 I' M6 S6 `3 N' y& ? // Enter the path to a model file! ' Z. [$ Y L+ P) x ~8 {3 F
simple.LoadModel("C:\\Models\\Test.spp");
2 W( A# w/ e9 X+ y7 }}
/ a8 x+ U( c: H R* Icatch (e)
/ X" r6 Z6 Y% U, A# }2 x{ $ T; R; a9 {/ G ` R! d" _
WScript.Echo("Could not load Model!"); . T( ?7 T5 r; c- d. B
WScript.Quit();
1 j2 V% }( C6 h6 a# N/ h}
* E; e5 [ O. O* |' X7 h/ S8 `8 { 0 V; J& d/ e( d! T# V* j
try
" n+ m0 `2 L. W3 D{ ( Z4 P- j4 s' O, w0 c: P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 `" h5 ~- w; p$ o r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 R, ?% E3 x& g0 R4 l8 M0 b' n if (r == vbCancel)
" m( v+ C$ S6 q. r, Q' p {
' ^$ i' G8 i5 e3 d8 y7 [5 h simple.CloseModel();
1 Y1 W7 q, I- r6 m/ t; P r" l WScript.Quit();
9 Z1 l: d& h2 ]2 B0 z: S }
0 z, }+ n" `3 o1 B}
7 ]/ j2 D8 `6 q1 P. G 4 W2 c9 n3 c& l- y! S# w/ H l
simple.StartSimulation(".Models.Frame.EventController");
0 Y: J/ m! k% q$ P8 o- X' u : g5 K" F( g1 }: o
if (simple.IsSimulationRunning())
) o |2 V- @( |1 D WScript.Echo("Simulation is running!"); 8 M# }. d+ p5 X# ~
" v1 l# C8 n" M. s; Z// Wait until simulation is finished
5 Q5 W K) F; v$ F+ `while (!Finished) WScript.Sleep(2000);
6 _9 t; @8 O' c
' M0 G" @! w) N4 x$ D8 F, Lsimple.CloseModel();
0 c, Q( G* G- r8 fsimple.Quit(); $ T( O) v, R. z8 S& ]
WScript.Quit();
, L( p# ?' N8 j$ l* [) u9 a) l0 X % [; E. E" m0 V C% @
6 d5 v5 Y" _- [* O0 Z
function RemoteControl_SimulationFinished() 4 m0 k6 O6 @6 B+ k! U' I9 U$ g N* d. B
{ 9 m* m8 B5 a9 s: k+ p7 I C
WScript.Echo("Simulation Finished!"); |