Example of a JScript 5 F* @, f) s4 e4 o
var vbOKCancel = 1; / ^3 O; c# ]" s1 b( w ]7 U1 w
var vbCancel = 2;
3 b3 g3 N$ V% f4 B/ x3 I( B+ a# fvar vbInformation = 64;
2 v3 ^! ]8 [4 H7 K4 l6 Gvar Finished=false;
' ^: n8 |( V5 Z# J8 w+ `
1 u) y3 M9 N, bvar WSHShell = new ActiveXObject("WScript.Shell");
6 Y; R( x& _3 \. w5 E 6 R! a2 Q& s7 b6 v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 R8 ?9 U# f( E7 ^4 L( G
3 a" D, g K$ X: usimple.SetLicenseType("Runtime"); ) Z' q( j) {! X- t% O6 T
2 h4 |- z9 O/ T9 e% g% K& xtry + S" `8 U8 o# T8 A
{
: _) _1 `( W5 F) i9 s+ H // Enter the path to a model file!
) ], y6 X8 a# b simple.LoadModel("C:\\Models\\Test.spp");
( m, s! }1 j$ u0 o _& _} 9 P- Z9 m0 E; e# M3 P1 t) g9 }
catch (e)
% m( S' Z+ L9 V7 n$ h% ]{ $ G% @4 m4 x. [" S
WScript.Echo("Could not load Model!");
" T& J z8 W4 C9 w; N/ |2 G9 Y WScript.Quit();
% t. m" T V' i+ w} 0 Z1 `" ?; ?' N5 k' F1 j( D5 q
9 A2 M) h% I, p& wtry & Y& ?' L1 d& M l3 C* ^( P
{ 7 `' K6 J, {/ @* A; _% k. o( C! ^- ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 Z4 E& i' K! E# G% x7 O+ _/ i- U
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 I) M& R7 B( M* s. S( v if (r == vbCancel)
. l2 {% ]8 }% J, }- _6 B {
2 K) j" k( l# j/ o- ?; k simple.CloseModel(); 8 S# t# y6 o8 [% e& z
WScript.Quit();
! G, r" O6 A+ Z+ Z }
- |( G, u9 v2 P- Z# f1 J8 y9 ^6 P2 C} 5 L# D, J+ M% {0 F5 I
% P- n! |# K; j; J/ x1 `
simple.StartSimulation(".Models.Frame.EventController"); / k( t3 Y& h, m: A6 P
6 T' d- L J/ }7 p1 z7 qif (simple.IsSimulationRunning())
6 L' @+ S& g5 |+ [7 b WScript.Echo("Simulation is running!");
2 ]$ R( O5 U# |
5 _9 n; g9 D# f3 l// Wait until simulation is finished
- i r" c5 B% a8 e q+ j/ b6 Awhile (!Finished) WScript.Sleep(2000); + f% C/ `7 w. d% U D2 N
8 }9 I; T# K0 M
simple.CloseModel();
3 ]# ^( O$ I' Vsimple.Quit();
5 d/ z/ l0 N5 g1 n! c; JWScript.Quit(); ) i$ M0 M3 J; Q/ ?* a/ ^) ~
) L/ \" r3 i( U* x& ~
$ o J( M" N- u I4 |function RemoteControl_SimulationFinished()
1 i- X& K. e# w2 f{ # N1 c' l4 m! a+ N; r: i( n9 K
WScript.Echo("Simulation Finished!"); |