Example of a JScript
+ J2 Z3 I4 D: G2 c1 b# ]) ~( h7 Jvar vbOKCancel = 1; 0 Y! E* N& H) v0 A* w5 x5 n7 m2 C& J& X
var vbCancel = 2; % f! u) `. b# ?( B) A# j
var vbInformation = 64; # S, q) @, c1 _$ Q* U
var Finished=false; 2 t/ S8 W ?' Q
- n$ A" Q" @3 m! w5 T
var WSHShell = new ActiveXObject("WScript.Shell");
2 v" P6 C$ ~5 t$ A7 { V6 @
1 f7 A6 t, ?' `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " p0 K4 \/ I. \ }3 ^- R
" u. W% O8 m6 O8 [* [! n( X$ L
simple.SetLicenseType("Runtime");
9 R% p$ a; n" C0 g1 ^ 4 x6 p0 |% I. T* k; g* ^' @, }* N
try - } l8 M0 |2 p- q8 s' g2 i
{
2 {9 f9 |# A7 T, Y$ O3 K/ v. e // Enter the path to a model file! ! v7 o: Y- |* F$ |
simple.LoadModel("C:\\Models\\Test.spp"); 5 j( }0 n4 t, D! p3 S+ ^. L
} : e* M. k9 d8 z& ^4 r; J
catch (e) ( B: A! h# \ c9 R6 o- [
{ 9 r3 T& P9 I6 A8 J& T- N
WScript.Echo("Could not load Model!");
# Z4 d; l6 c0 _7 Q WScript.Quit(); " I7 P+ H3 J* s/ h
} " r: ?& _# X8 @( q3 c
( m! w- `+ I( x: `, o0 N/ ^1 @6 Z5 `% L
try 2 z7 o; \% ]4 h" V7 ~8 J% P' q. N( B% A
{ 5 |' a5 e* o9 H1 T; a+ f, R- ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ Z4 p8 D2 z6 W3 h2 k3 J, |8 G* q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- _0 }4 W! G3 Z8 T if (r == vbCancel) ' s) q6 T( G8 a; N& C) c
{ * d' u, H: ]" { u% h
simple.CloseModel(); & u1 R: v$ x# N
WScript.Quit(); + @+ ~0 T2 H, J5 V0 f
} " \- y0 _/ \( P
} 3 Z+ ~2 M) V5 d
7 ~. J( U/ G0 d# ?( jsimple.StartSimulation(".Models.Frame.EventController"); 1 d3 J! w4 f. R% W) g. P& |
! i% I5 q8 ~- H# E: ]* `
if (simple.IsSimulationRunning()) 6 g2 N5 c9 A* h: i1 ` |; r. M
WScript.Echo("Simulation is running!"); + o3 c0 x) l& ~8 K+ C9 `2 ^. u
4 L/ T. ~( U. E0 f; [( o5 q* ~4 }// Wait until simulation is finished
1 i# x Q0 W. y: U8 T) Nwhile (!Finished) WScript.Sleep(2000); ! K# W0 e/ h" k/ z- D
( V/ K: b: ~8 \; s
simple.CloseModel();
, r! Z; C: k& `4 psimple.Quit();
# T Q4 Q/ `' Z4 J" S Y! qWScript.Quit(); % T: k1 i6 @ b
: z4 ]2 N1 g# x/ a
9 l4 d: j5 f$ W: ]* y6 W
function RemoteControl_SimulationFinished() / y, ]! F: [& p$ y9 ]8 F! n* R
{ 1 @# ~) ]" |, Y+ E8 F) a
WScript.Echo("Simulation Finished!"); |