Example of a JScript 6 r" J7 o1 s/ Z
var vbOKCancel = 1; 3 A( E- {) i6 R8 T' F
var vbCancel = 2; 0 y) C$ a" C( `! r
var vbInformation = 64; 9 M, Z! I( ^$ |, F$ s6 @
var Finished=false; 3 j' A, v ~* R! ^/ _7 L# H
$ |0 G$ B5 }3 W' H& L3 {. `/ h0 D
var WSHShell = new ActiveXObject("WScript.Shell");
1 j h) ~# i9 c# I1 |+ C 2 {& p( F0 k7 J7 x. N0 G
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 f8 O# ?) f# u% E" f
$ E) k+ K; \* I& ?( }
simple.SetLicenseType("Runtime"); 8 y0 k. n M+ w' D5 N7 @/ H8 x
t) q- x {' b5 z8 n
try * g! k2 r" X8 M$ j! ]
{
4 q; a2 J m' _! m0 t5 n! O // Enter the path to a model file! 3 w5 S* M4 G+ }; `3 b' ~5 Z+ {
simple.LoadModel("C:\\Models\\Test.spp"); + J7 Q) R2 ~" W" W' O% l. r+ @+ S6 g- U
}
7 H3 K" H6 }% n: b& ~catch (e)
0 o& |3 J, K: L% O4 T{
- S; I. C! B( d. E; Q9 L5 [, {; \ WScript.Echo("Could not load Model!"); 0 N8 t5 o1 U5 I
WScript.Quit();
# D1 S& y. V" n/ `, l8 t} ! ?0 ~; F: ]% d( Z
6 _. }- E( p) a
try
# M$ V' Y4 r) i$ z: y{ 8 p1 C$ |" |( p) [: w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # b6 k, V: n8 h5 z+ c7 a* K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 ? Y' t% i3 Y- ~! F
if (r == vbCancel)
+ U- m% k% N% E# f8 H: h { - a7 X$ L: g% `, N/ f! p
simple.CloseModel(); * C" M; L2 A+ U4 A& w# F
WScript.Quit();
' @) v1 l2 \9 ^: O* r! P4 E } & M; y6 y. E5 N4 D( w3 D* b
} 9 f3 _: S9 v# n# ^/ ?
/ l+ H5 a; P0 p. C
simple.StartSimulation(".Models.Frame.EventController"); 7 A5 o: }' Y+ ^+ q8 S- ~6 P
4 N+ m5 Z! H0 oif (simple.IsSimulationRunning())
' K) A! H' s/ n0 Z* X& G" x WScript.Echo("Simulation is running!"); [" r- Z! Q$ g% I+ |+ U
% \! l- Q) A. {" S" V// Wait until simulation is finished
; U8 ~8 {! W7 F( r/ @7 [while (!Finished) WScript.Sleep(2000); 0 i2 K/ O: _& Z1 _
+ c0 D. M" L* t+ qsimple.CloseModel();
( q7 J' e8 A; k" hsimple.Quit();
1 F4 n8 {; ^. U, lWScript.Quit();
3 O! T& S/ r0 w) v" f2 P0 X8 m8 C2 S1 m, M 5 C0 [( z# h+ k S0 o7 \' |
6 j& X& G1 p3 O5 Z! s" |
function RemoteControl_SimulationFinished() ! G% x3 H3 j9 t L0 P# d X/ j* d c/ |
{ 2 r9 |. _# N' o
WScript.Echo("Simulation Finished!"); |