Example of a JScript
: D$ o5 N8 O2 Q* @5 ~8 zvar vbOKCancel = 1; ( U! P) t0 w o+ S" _0 e8 c, n2 a& [
var vbCancel = 2; . D3 d# `) z W
var vbInformation = 64;
6 d6 f9 L2 R4 D a& M5 r& |+ x) gvar Finished=false; ; _# Z" L% z0 ~8 `( r' L
: p) F( u4 B, n( j- _/ ]var WSHShell = new ActiveXObject("WScript.Shell");
: ~, R i5 G" ~) p6 g0 s, ^- x
9 C; d8 a9 D# D! M# Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # @$ W; G( G" p; i# W- [
9 u9 R$ O6 d: K; Osimple.SetLicenseType("Runtime");
) H( M$ ?! i& i3 |* H3 d* y - V; R# Q, z& X( ~( G3 J
try . k8 e9 w; P/ _8 }5 i7 J8 `
{
# \6 ~" D o7 m- X; a( O7 I, r& @ // Enter the path to a model file! 5 h4 d3 D4 N# h, f5 p2 y
simple.LoadModel("C:\\Models\\Test.spp");
o( R8 s7 F; f; A5 {2 F} : Y: p+ j$ U, @! t
catch (e)
8 A! I9 x2 s. [6 p7 w{ % d3 C5 ?; m% @" M- C
WScript.Echo("Could not load Model!"); . l% F1 q f& K/ q9 l3 |
WScript.Quit(); 8 a5 A% \$ }* |
} 0 L. h/ U" e, w8 `6 h/ [
+ [, d- _* J x! ~try ' {" M- S3 ^' P0 ~; @% \
{ / B( b: d( X# \
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# Z! ?. n8 Y" T1 u( u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 }) e/ o. K1 l' q' Q# w if (r == vbCancel) t+ ^9 a* {7 v/ K6 N7 W
{ " ~2 f- q4 _4 p0 d* X. z! f
simple.CloseModel();
/ E' O2 b. ~( g6 [ V9 |: c WScript.Quit(); 5 g, f1 C' s) C# B/ v5 d6 r6 W+ m
}
) V9 }% { O" T2 j}
* D' Y C# e2 d* S, F* H8 Q 5 [# L' y# u* V$ D; Y. N
simple.StartSimulation(".Models.Frame.EventController");
+ i8 I$ ?9 {6 U # h; d6 f4 w0 A9 G! w! J& V% T
if (simple.IsSimulationRunning())
. |* M2 F+ f/ U2 C6 y. Z WScript.Echo("Simulation is running!"); % n& g0 M6 r/ i5 C
4 w0 E9 C8 ^6 B1 x7 X" n" R* j// Wait until simulation is finished + X4 g, G' t3 |6 x: Y4 N* s+ g. h' x6 u
while (!Finished) WScript.Sleep(2000); : A: a# Y$ S5 t- J0 }3 L4 |1 \3 r
& ?: \# \8 c5 s3 C; ]) U5 msimple.CloseModel();
: W% B A) C( m# fsimple.Quit(); ( Q! }* D* S4 a% m: P7 a
WScript.Quit();
7 Z0 j$ {. U) E ` 4 ?, R* m: X# [& v h! X# D
8 _/ S2 H3 G- {3 h5 lfunction RemoteControl_SimulationFinished()
$ Y2 p6 o7 N- e: O" E) w{
1 X- T a6 s2 u6 e1 @ WScript.Echo("Simulation Finished!"); |