Example of a JScript * o* [* F' g6 Q6 A5 o! A* k
var vbOKCancel = 1; " M1 Y! d7 o6 F+ f7 U4 |' V0 i
var vbCancel = 2; 5 S: K0 h+ G1 R1 _ Z
var vbInformation = 64;
( Q3 s( P" t4 ^: m# Bvar Finished=false;
% `: n) o7 x3 i0 r. n$ J
. f& _( x, ^: k8 evar WSHShell = new ActiveXObject("WScript.Shell");
$ j5 g; r4 ^" C7 ]) i7 } 3 i8 n" |' X7 u
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 m$ a& }5 Z( Z. O3 N1 r9 Q- J: |
1 B2 |. ] d) D- n9 V8 n7 {6 t
simple.SetLicenseType("Runtime"); M7 x+ H: g! m
' R% h6 d1 Y9 P [
try
. c$ R7 Y! j' v2 K{ 7 R: V r; @7 Z! u. u9 e
// Enter the path to a model file!
6 v; J9 r! V! |: U simple.LoadModel("C:\\Models\\Test.spp");
# V8 O7 {% G# Y3 ^}
8 V6 K0 G# m6 g9 \2 g/ }catch (e)
0 @2 G- {! f; {1 D% O B8 N0 g& S: E{ 8 H& {4 p* _- f9 G
WScript.Echo("Could not load Model!"); 1 ]) @! U- L: ^: y- P, k
WScript.Quit();
) w+ f8 D5 V0 C3 k& O/ x! M- `. y} $ j- {' i) g) `) ~. K Z
8 k; c( Y! n) s( R" h& wtry
, V; a* I, C8 t8 ^7 F' C z{
4 \4 Z# f7 K+ O' m0 x t- v) y. y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! ?( B1 u2 c1 O v" P( Q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# V. Y9 j& \* b4 r q" X) [ if (r == vbCancel)
' I( k1 N; ]9 l& s9 y+ ~2 X { 0 @" Z& {% ~' C; E' W% O
simple.CloseModel();
6 S1 X* \. T6 c8 i WScript.Quit(); " \8 E7 ]! {$ e2 N2 W
} : Z3 {5 h" h' |% y L6 ~. @
} 6 s9 p, J# e3 d9 p
1 } ?/ h' T1 [0 osimple.StartSimulation(".Models.Frame.EventController"); {8 r- ?( ~ R
z O& O2 p4 {( Fif (simple.IsSimulationRunning()) + z4 C' D: t" Q) G4 X' I& S( e
WScript.Echo("Simulation is running!");
( t# o% I" l% z+ N* }4 e 3 o. D* M) g- M
// Wait until simulation is finished
4 h2 Z2 u* c2 v6 n7 Swhile (!Finished) WScript.Sleep(2000); 3 T3 }, Z2 S' z7 Z
1 D9 T! K) A6 J8 tsimple.CloseModel(); ) Q" {7 R+ b- d; {7 z* y
simple.Quit();
( Q' s# w, [" \* v$ kWScript.Quit();
" k; V3 _& G$ P9 h7 \5 W; D' ~9 V7 Z ! j& U4 h" h3 [# _4 o2 ~) C
% J! Z" ^0 I3 S/ ?function RemoteControl_SimulationFinished() $ L* W9 R# K3 ~; C: `
{ 6 P! }( C: q3 L {8 ~* T
WScript.Echo("Simulation Finished!"); |