Example of a JScript
O, `9 w1 z+ ~9 qvar vbOKCancel = 1; 3 m5 h2 v, y; m( L
var vbCancel = 2;
0 W; E+ l+ d$ i9 S% V: Cvar vbInformation = 64; 6 h; w& p1 k1 H1 m. k$ W/ l" W
var Finished=false; a- Q1 L; }( b
$ f! n' q j7 X6 t s( W+ r% F7 b9 z
var WSHShell = new ActiveXObject("WScript.Shell");
! w$ A' f4 T9 R; n" h ( }' f! {4 x" g @! H( o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 }6 \2 L) N+ `9 ^$ i P5 R6 T 0 S% K$ u% u7 V& _0 h
simple.SetLicenseType("Runtime"); ; b% y1 P! ^/ a6 w
3 N9 {1 O9 U$ itry ( y' f0 e+ i6 ^9 r. n# N
{ " ~% v0 s. b7 m0 c! Q* i
// Enter the path to a model file! " F6 T4 i1 Q) b( P1 u
simple.LoadModel("C:\\Models\\Test.spp");
5 Y( Z: l X4 {6 m7 A} ( n" e6 M4 O, T, M2 c( F- C( S. S( |
catch (e) 3 m# {( Q/ X3 D' \# G5 l
{ , H' r6 R, r# | P( t% n' U6 K
WScript.Echo("Could not load Model!");
) m: i: `& `# _# z$ t. t' D WScript.Quit(); 7 n0 c/ Z. x# ?# I
} 7 p! Z+ @! y% M9 `
4 t3 P$ H1 o/ X$ g1 c" K( k
try
& l5 A5 I0 p4 b3 x{ . G7 u* i5 F5 ` ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- @/ T4 ^7 s C6 [" G. l; F r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 Q( ^6 {6 H8 c% @: k
if (r == vbCancel)
5 j& o' `" I: c& | {
H) {; T+ u3 `: f simple.CloseModel(); : N" h! P3 k/ i s
WScript.Quit();
0 M8 _+ }. k* W, J" q& M; C, b8 H( l }
# T& G/ [. \ [ {3 |" o7 e} , i9 u6 `8 w- s% R! T, a* i
5 d7 n3 R1 b# ?simple.StartSimulation(".Models.Frame.EventController"); ! H* L; Z5 ?' }* N+ |7 H
7 Z* L' h6 y# V" f# D m
if (simple.IsSimulationRunning())
/ s+ d s8 S: T4 D WScript.Echo("Simulation is running!");
% H# _$ o: y. }; a8 Q" ?% x * @% V! j/ J1 v; p$ J
// Wait until simulation is finished 2 J+ g& H" x# x7 p
while (!Finished) WScript.Sleep(2000);
2 }4 ?4 D8 j9 l
$ n- r$ O2 H/ w( ~8 p8 Dsimple.CloseModel(); ( A5 U0 X6 m. k; V' @
simple.Quit(); 9 d X0 `2 {$ Q# |
WScript.Quit();
( O3 e8 H( q8 f7 @' d, x , R: F+ j6 m% F: S! ^# W0 ?6 \
9 a( E. c3 j# i0 t! M$ |
function RemoteControl_SimulationFinished() # |! c. `1 F. j' X; @3 b" t+ A1 P
{
- I7 C; O1 G t( r; O WScript.Echo("Simulation Finished!"); |