Example of a JScript
$ x. P* \2 n7 g+ ?var vbOKCancel = 1;
( a, _0 _. w1 @0 C$ Bvar vbCancel = 2; # ~. {9 Y$ N( k
var vbInformation = 64; $ n8 K8 I, F8 C
var Finished=false; 2 u# } u( @' I- H# l/ L, d5 k( Y
3 ]) z# q: i* ~8 f2 f
var WSHShell = new ActiveXObject("WScript.Shell");
; l& n3 H8 k% u( h- g & A- [4 a7 L. y( ?, {4 o! }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 k$ @. I. a8 u9 V% x- V3 w; Y0 O
4 D' ?5 l8 G: w; o
simple.SetLicenseType("Runtime"); % L/ s( u7 C( B& y( @: L7 ?
/ m, R- B) E# N k3 jtry . J8 }7 b5 ?5 t- M7 t
{ - c: @' ^0 {6 X2 J6 I* w2 f9 I
// Enter the path to a model file!
/ U, I6 ^8 ]% }; T) n3 p2 _) L3 C simple.LoadModel("C:\\Models\\Test.spp");
$ ~6 W. }, N, O2 n- c% j}
( P9 o" u M1 s0 h, F/ b9 {catch (e) ) l/ c+ I3 E9 y n% P' t
{
9 A% K a% j& r$ j& A WScript.Echo("Could not load Model!");
2 E& l2 h! T2 f( z WScript.Quit(); & r& C! S4 N8 G
} 4 |: O+ Y6 Z" o/ Q8 ?0 G
; l; i( Q8 Q& s" {1 r# l) i
try Y2 _# B% p5 j8 y3 ]4 u
{ : k: H" W* Z- n* ~4 a; ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + E- c7 i5 J5 Z& |2 d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 @/ u9 M2 N$ @( l3 a2 K
if (r == vbCancel) & q& b7 p7 b3 d3 Y' ~, L
{
8 O: e* F" M G6 G0 N0 k simple.CloseModel();
( o+ i/ W) [' [& @5 M3 C N WScript.Quit(); 2 _) h- w+ x8 X( h8 D4 R
}
) H# n; n3 Y& }2 }. V}
- Y* v; @. m) N4 j
4 n8 g5 n$ Q3 ]7 b* i+ C7 q4 }/ ]! usimple.StartSimulation(".Models.Frame.EventController"); 3 s2 h1 U1 Y: h" x3 y* k0 z
5 u* [' c( F8 I( Jif (simple.IsSimulationRunning())
7 }, ]6 r. J4 V5 X' B' l WScript.Echo("Simulation is running!");
2 a2 `6 f/ y9 R6 i: W/ Y, X 2 u- Q2 B, {' ~6 y
// Wait until simulation is finished
" O1 a/ d& F: p' Q5 Y- t, _3 Xwhile (!Finished) WScript.Sleep(2000);
) B& m5 F8 S- e+ i, k " X, ~3 f" o, u! ^6 @5 O" u
simple.CloseModel();
( `/ P4 V4 c( msimple.Quit();
) T! m, d7 {* B: l1 S6 KWScript.Quit(); ^0 M( x4 c6 S# S
3 @' p3 S4 ?2 g" a
! ?4 K, R4 ^5 T# ? r7 ^function RemoteControl_SimulationFinished() 2 c5 |, K' P5 d" }
{ 9 V. v, H, D+ X, k5 ], D
WScript.Echo("Simulation Finished!"); |