Example of a JScript ! o! u& l% T" E, H
var vbOKCancel = 1; % X4 U' T: ~& Z; |/ x$ f
var vbCancel = 2;
0 C0 v z9 i6 e: T; Uvar vbInformation = 64;
' [! O! t; m( Q$ U* V& K- J% |# Vvar Finished=false; G) N" q" h' p
! @2 c$ I* _1 R) [* t$ G
var WSHShell = new ActiveXObject("WScript.Shell"); 2 x* m2 K1 w/ r" X- H0 i; ?
; A C; d# v/ f; ~var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ n/ ], m0 w# J! k # w) z# ]6 R% F1 O$ r9 A
simple.SetLicenseType("Runtime");
0 J/ K2 g' ?- y" D 0 ~) h0 a( X. z; a; V1 T/ w
try
. a J g5 S6 ~5 n2 K; u{ * R! [# t( a1 T" V o o
// Enter the path to a model file!
2 J0 ] `+ R a$ f* T5 W8 ]7 G simple.LoadModel("C:\\Models\\Test.spp");
4 B/ r# g9 R7 m' E% \0 v& q}
9 O) @9 i5 q$ ?6 u* }* C9 Qcatch (e) / v$ J& h4 Y3 T7 p' g/ Z
{
7 ~; u8 |2 Q* v9 F1 n5 n( L WScript.Echo("Could not load Model!"); 0 ?6 k h2 i0 \0 D) h I7 N8 g3 x
WScript.Quit();
; }, M1 T2 \1 p}
" X* Y& L4 R' A ' Q& g p5 x% o) y
try ! m$ W' M: D( P. |* i" m
{
8 Q* D h6 k. A; g( e" O8 B: I8 [ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' ? f3 `+ e7 ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : z* K9 g2 B) |
if (r == vbCancel)
9 d) _; S' z% D9 W2 z: z1 R {
, Q: p; E" G' q7 t: E simple.CloseModel();
( H9 Z6 o+ x% m: a( w' t: q WScript.Quit();
. ?4 X% k7 s! ]' Z/ T }
' N" }6 A4 ]/ c8 ]" x( g! I. [2 z} 3 y2 l4 p( p+ ]1 \: q* Q
- V# t- c0 Z, N5 i
simple.StartSimulation(".Models.Frame.EventController"); ( D! d0 d- t( `
( K4 d( B( U. Q. @, n7 m& W: ^if (simple.IsSimulationRunning())
3 X# ]; ~5 ^* s' b; c+ v WScript.Echo("Simulation is running!"); 7 p' o7 @$ W* A# j& `0 F3 M3 |
# v5 K5 Q9 ]; l( x1 r
// Wait until simulation is finished * Z1 H& o3 p! p& ]
while (!Finished) WScript.Sleep(2000); & w l b7 b7 j3 o/ }$ ~2 W" _+ V
- |5 h! G; x# l8 x. s7 t
simple.CloseModel(); ; t& Z6 B4 @0 t9 z- @( X3 K
simple.Quit();
; m9 l3 K% v! Q0 XWScript.Quit();
& z8 Y, E% l. [. A! L6 |9 j1 i& k
& `5 j' y0 `( s9 J! j# f9 |
6 j! U3 Q2 r% ?6 ~, jfunction RemoteControl_SimulationFinished()
( R! n* }, Z7 K2 W3 e{ % g0 U; ^$ U# q1 k$ c. T5 A
WScript.Echo("Simulation Finished!"); |