Example of a JScript
7 c: h5 ^3 f3 lvar vbOKCancel = 1; ) A& z, e7 L5 O' C
var vbCancel = 2; 2 O4 l" o" t2 A" k4 }: M/ D: ^
var vbInformation = 64;
" n8 R( @' j, G4 N; p" Evar Finished=false;
9 k' o0 o( |( R# y: T8 L 3 V8 ^8 h6 H! V3 g- _
var WSHShell = new ActiveXObject("WScript.Shell"); + O2 k3 @# I0 R! e+ I! k
+ q9 u& w0 Q( Q9 `2 B& U3 g2 e" d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 I7 r! x- P: F3 r7 w: d0 |) @
& w7 G% R; c% P( ]! }& C$ m; x
simple.SetLicenseType("Runtime");
7 O; U/ G( ] v7 A' \# ?. c
% V; Y, Z$ [" xtry
5 R2 Q9 [& j: g6 E, P3 r) D{
3 v* l2 p( Y! I1 X0 E8 u# t' p // Enter the path to a model file!
- C! e! M; h2 w+ \% z/ ?( m1 w9 a simple.LoadModel("C:\\Models\\Test.spp"); 4 i+ d+ Y6 N6 O8 `/ j+ T5 q2 G
}
; n5 Z9 n0 L. n7 w- rcatch (e) * U2 c C# C1 o1 G/ y
{ ; `! P: Y) `1 A0 Z9 ?. d: I2 g
WScript.Echo("Could not load Model!");
% Q3 ^6 o, K, o7 f/ _6 v" x3 b6 I4 Q WScript.Quit(); 8 v# r8 |+ }/ q9 y! K9 \
}
, ?" b# L3 O' }$ o9 [" a
, L" O4 }3 C8 S! b$ C0 D/ Otry # |, K, ]" S9 z7 J- r m9 T1 x
{
) l& E. H. w: V* b" V( t# F# X simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 l8 X" l' l6 w/ Y, `- ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 T1 i m1 l! A" |1 F! z
if (r == vbCancel)
6 ]/ I4 A. A: R H* W# ? { $ w: E* N8 m" q" l2 H" I
simple.CloseModel();
$ c3 U* v$ _! A4 g4 t0 g- v$ T WScript.Quit(); 7 N# N D5 J) O- V5 i: F
} 2 e7 Z5 Z' ~ m0 i
} H3 k1 O" |* E1 L }5 \
4 u6 S* c" T: L, Q2 T8 @simple.StartSimulation(".Models.Frame.EventController"); & w0 k" q. v+ x8 y
. C' p) z J& x" r' V
if (simple.IsSimulationRunning()) ^$ H9 B% G, ]3 o" P5 |
WScript.Echo("Simulation is running!");
# j( J# |. w* R : x1 W9 R+ B6 z) r
// Wait until simulation is finished ( C" c3 Z$ r1 l/ @: K \8 S: ]
while (!Finished) WScript.Sleep(2000);
2 D- e" D2 r6 }& r9 C/ T& s 5 P% M Q( l6 s% }, j
simple.CloseModel(); - E( f6 [# h3 @9 L" e, c
simple.Quit(); % M* C: Q( p; N9 }. s4 M/ h
WScript.Quit(); ! [2 E7 ~2 z! j d( r2 O9 ^
/ N2 g* j) C. d* P) a8 p" c
8 ^: B6 V$ ^8 Q
function RemoteControl_SimulationFinished()
5 {5 `+ G: ~/ x. k" g" ~ Q% s{
8 q' }& @# Z* g9 }0 y$ r6 V9 ~0 o: B0 h WScript.Echo("Simulation Finished!"); |