Example of a JScript
1 h+ u' ]3 n2 H" l" m: ]6 qvar vbOKCancel = 1; ; L6 c) A0 ~9 o$ d% z
var vbCancel = 2; 9 F" \7 [ O8 |
var vbInformation = 64; . j4 C# `; h! R2 B" d4 w- j
var Finished=false;
" b7 d! [% L I/ e. R
+ M% C: S9 t) ?/ Hvar WSHShell = new ActiveXObject("WScript.Shell");
/ a; f5 l9 `3 ?: }: ]
* ?7 j. S7 i6 g4 U: X. fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* H" V+ W$ E9 E; H! C' ] }" {
1 h2 l& ^. S1 D. j2 i( Rsimple.SetLicenseType("Runtime"); ; n$ g' H# s$ T9 T# |
" o9 V" |; ], [7 q1 ~, k
try : Z/ m3 V$ f$ E0 x& C. y! I
{
; Y& q6 L6 V6 z( W' { // Enter the path to a model file!
- P% H% d' r2 _: `; @4 |( I) W: C simple.LoadModel("C:\\Models\\Test.spp"); " p( X: b w+ w3 J( L' F* g" z
} 2 Z4 B9 \; @' V; m0 ^
catch (e) ) r0 H1 u: ]9 ^: S7 R2 O
{ ) @' }8 w5 q! Z8 H/ s: V' u; J
WScript.Echo("Could not load Model!"); & Z1 l5 d6 a' ~; ] s
WScript.Quit();
1 N8 M" C# `& [' n$ I}
& y0 t5 u# \: c9 \5 F ! b8 k1 z8 ?# }2 R0 l d
try
/ p$ P: v6 B8 }# r! p{
6 Y, m% N$ V( y! {8 \ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! x2 r1 E$ @$ n+ b% Y+ d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" q$ }6 L* E$ U+ C if (r == vbCancel)
/ v6 o0 I( e( w! d$ ~6 \: \ {
& E4 a( `. ]. o: }# d simple.CloseModel();
2 a$ i! ^1 U/ T1 }. v$ b WScript.Quit(); ! g2 B# K- f, V1 Q+ a8 F) J
} . |) J0 t% K K4 M
}
1 W d0 P8 ]" m6 u: i: d7 E
7 R% U6 I, t2 e$ d; M" @' E0 Osimple.StartSimulation(".Models.Frame.EventController");
9 R* B/ t; s4 D3 Z1 F
4 \; P, T) I8 `- C+ C0 I6 Eif (simple.IsSimulationRunning())
4 e+ b7 m: _/ D5 \/ i) }5 L% C WScript.Echo("Simulation is running!");
2 [* j! |) G4 H: M7 m! L/ L / Q% X, T7 U: @# }" m% z
// Wait until simulation is finished
& G) R X* D' \5 A$ A. G \ ?while (!Finished) WScript.Sleep(2000); # n# X% h* B9 a1 p. b
z6 {9 X J' K* c1 L
simple.CloseModel(); 5 o5 E( r5 b' `. }2 A- S
simple.Quit(); ' K( V: g3 Z4 g% t6 \9 ]
WScript.Quit();
. v9 A6 N& Q) \5 K6 F' G' p 1 F" `: a- |) m8 B
$ B# C* h0 S/ y* i" Jfunction RemoteControl_SimulationFinished() 5 Y% ?4 Q d! J
{ * ^7 n2 B' h9 D* k2 ` C
WScript.Echo("Simulation Finished!"); |