Example of a JScript 7 y, u- n. t. K
var vbOKCancel = 1;
/ }9 a" H* {. t! l/ n }: y3 `# dvar vbCancel = 2; _5 m- o7 u5 g
var vbInformation = 64; + J6 j. T0 e" E, I& s2 Z
var Finished=false; & D' z C2 E3 G* v6 P2 B8 K& p
) @! ?, ~5 B- J1 ivar WSHShell = new ActiveXObject("WScript.Shell"); 4 ]8 `9 l( Z* ]: x6 d9 n
- k0 s' B- r" H: x: L' |# e1 ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : L" K/ v1 s# P1 Y% ?, E( H# t
+ j( m# I% ~) z! }/ Usimple.SetLicenseType("Runtime"); & }3 Z I2 F7 a+ T
4 @" I! C4 y* u: |( y$ ^( S' Z
try , p4 A: U# a3 z5 ^1 k( ~- V$ J' A
{ 0 |; Z4 G/ y* ~1 G9 d
// Enter the path to a model file! 0 V& Z& H3 o, J9 o' \. w A
simple.LoadModel("C:\\Models\\Test.spp");
7 l3 @% \6 [4 n3 f( R, n# O}
) `) C# l" q0 Ncatch (e) 7 z2 w; Q' w) E m! F# T* g
{ 3 f5 z2 l4 T+ ?2 L0 j
WScript.Echo("Could not load Model!"); ! s8 U' B% R' i: r8 V3 j
WScript.Quit(); % k2 N+ M. r3 y: _9 E
} ( {& s) g; a8 E
' c; }2 V0 G- Ktry
8 M+ l' ]! m3 b5 I{
9 m2 @" |, {3 {$ |$ J' U$ P: W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" t9 L) d5 j; u/ L/ w; e9 M% _+ j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 S5 g, Y5 l+ u4 L8 F; T9 w. j if (r == vbCancel)
5 X! y# r7 w. Q+ f, B {
2 k/ }1 u; P c7 D. n4 V simple.CloseModel(); ) C$ j+ A d2 g
WScript.Quit(); 8 @) b% m" a7 V# F6 o' o7 i" @
}
2 D y# ~3 C2 K, ^6 g& K5 {} / ?" r. S, Y v6 z; E0 v Q
9 L0 B+ [; n, a9 o8 D: M
simple.StartSimulation(".Models.Frame.EventController");
K5 _2 g) z4 t& L! T + g/ H% Z0 J: H1 _/ X5 \" r
if (simple.IsSimulationRunning()) + P8 h* r1 ]6 D1 s1 |. o7 l5 @
WScript.Echo("Simulation is running!");
- b- R( R% x6 z4 m N, \: B
; }" F6 ~. R- o// Wait until simulation is finished
* ^( F- T2 i, w# ?5 Zwhile (!Finished) WScript.Sleep(2000);
$ o% N, Q3 Y e: P2 o4 I4 H 1 ]! U5 m3 p) q$ e
simple.CloseModel(); $ ?0 M$ j" [5 B: J4 c- g
simple.Quit(); 7 G* K( I. V* V; b5 ?1 M
WScript.Quit();
! J" G: i. B( t" O2 h
! n9 O; K! x7 y& k 1 i& m6 n" u, B0 P9 F1 l
function RemoteControl_SimulationFinished()
* b7 [. w2 D4 _2 p8 o{
9 i0 V+ g' c6 ^, m, s9 y+ m WScript.Echo("Simulation Finished!"); |