Example of a JScript ( v/ t0 Z' A6 |8 ?) K) f# v( q
var vbOKCancel = 1;
# X" a. K# z2 V( S& a7 k- H; Xvar vbCancel = 2; ( w$ k2 b) {9 U
var vbInformation = 64;
" M7 h# [# T' P8 u! r- a$ }4 Vvar Finished=false;
" B6 z% X3 V; \: W# s: w5 i
& w- \# J7 h5 f6 n" m7 Z5 c$ n9 evar WSHShell = new ActiveXObject("WScript.Shell"); 3 b! ]5 d% _: a" m" i2 O5 r
, w/ m7 n" \, [3 ?; [, L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 `: U8 {" K2 M7 k/ j) y
& \$ {$ p3 e% r+ _& H' D- Rsimple.SetLicenseType("Runtime"); ' O1 L) ~5 J+ q9 h
) `7 ^* T2 P! ~, |/ |, `2 H1 Z
try
/ H% M6 G: M0 j7 n s{
, u+ g6 E* s2 A // Enter the path to a model file!
$ I9 a' l# z- d: w6 M' w simple.LoadModel("C:\\Models\\Test.spp"); ! T0 V1 ]- M/ I! _1 R4 Z0 Z
} 4 D, ?3 F6 B, o8 a4 r- a
catch (e) + o5 p' Z. K+ Q6 Y" ?
{ : b. @& }3 L) o
WScript.Echo("Could not load Model!");
& X" u8 o: i! B8 \! u WScript.Quit(); 9 v- i/ ^. w- n; c: V9 Y% R1 ]
}
" P* r$ u! ^7 v: [2 W7 I) P
+ [. Q( P- [" B5 B* L! Utry
8 T& m) F5 d0 G) M" h{
8 D5 J( F( o4 t9 a# v8 d: e# w' @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 d% M- s/ R$ s& q- l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 O6 S* A/ v* a r& N if (r == vbCancel)
3 ^+ Y# K. f, p6 h5 V1 M& r, d8 ^9 T { % w% B1 P! n& N, M1 ?: D
simple.CloseModel(); % k1 R% p! I7 o$ Z, D
WScript.Quit();
3 K( z3 v _7 P } 1 |& S9 B& d$ |
} ! |3 k1 j$ M9 O L, }& Z
M9 p' g4 c, {, w" n1 s; ~$ zsimple.StartSimulation(".Models.Frame.EventController");
& c% K5 P- h! o7 {% m; Y , w( _" V9 M* v5 I4 t
if (simple.IsSimulationRunning())
6 L Q* l: F. Z# e WScript.Echo("Simulation is running!"); : W, o7 o( r! ^/ k- [
7 V8 F7 Q# { [' B$ a0 ?7 {9 M
// Wait until simulation is finished
5 T' O* p- ]9 C+ Gwhile (!Finished) WScript.Sleep(2000); ! j; f8 Z2 M$ r1 P1 _1 T
/ U/ p* ]* T! ~) y0 A
simple.CloseModel(); ) o5 h/ R( l7 e* Z8 d& J7 x* x
simple.Quit();
. Z& G+ ~, B8 h: o, K8 }WScript.Quit();
5 U' f3 T, J6 L$ C $ p' h: O, ~' G& A B
9 W+ z3 U8 A/ {6 jfunction RemoteControl_SimulationFinished()
5 k& m( P& X. i0 L5 S4 R{
# U$ A( Y6 e0 C/ m& q# |2 Z$ ? WScript.Echo("Simulation Finished!"); |