Example of a JScript
. E/ X. A4 R) S6 dvar vbOKCancel = 1;
+ y0 N% J/ d6 u& ]7 Rvar vbCancel = 2;
" u1 A0 C" I! S4 H) y; uvar vbInformation = 64;
2 J$ I1 U+ {# w# tvar Finished=false;
: O$ M- ~& r; w
/ W3 P7 {# `, {4 Ivar WSHShell = new ActiveXObject("WScript.Shell"); 8 Y9 X' a* D6 j1 a
9 g* {! |. x* G Y) `+ b2 {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 ?( B' G2 H; h2 ]7 w2 r( \/ j6 n1 r/ Q
+ s+ }& }: L9 b6 P- C& ~simple.SetLicenseType("Runtime"); : N. N& t- V$ T5 q. M2 }
" l" t; h* ^6 L/ G) k
try : w7 O/ H& Z, c: b$ e, b
{
' P3 ^1 A; ?1 [5 ^( u) S- s) ^6 ^ // Enter the path to a model file! / h( B* I, }0 I4 N; [7 |% B
simple.LoadModel("C:\\Models\\Test.spp"); , \( g w/ w; L1 v
} & t- g& S$ \5 s. i9 F ?
catch (e)
( y- y( n8 ~2 M) i" ]& C{ 0 F, [3 a( H; ?+ T
WScript.Echo("Could not load Model!"); 8 Q; v) B: S! i% X' ^, Q0 s; P
WScript.Quit();
) p2 I3 c- a) x I7 g} & n7 I+ {; t) |7 F8 K$ d9 Z2 D3 O$ t
) l; x% l3 @6 P+ v
try ! r* Q! t) R$ [
{
+ z! X. e& j G4 N: i& m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: W' K* s K) s: q* n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& Z8 }1 X, f$ Q$ y' k' U" T) [0 }! l if (r == vbCancel) / V9 R2 T8 E- b" X7 Z0 G* N
{ + e2 S& y2 R6 P7 r8 u: v
simple.CloseModel();
: Z1 Y- ?# e/ \% E7 t; H WScript.Quit(); 0 p& D% B- N! I
} : ~! D3 ]6 l* U3 ~
}
! }( p3 d( L! d " O% ]- y8 A- T& @" ]1 [8 F
simple.StartSimulation(".Models.Frame.EventController");
7 y2 [# i# Z c2 C) W( N , Y0 i& Z. }# W
if (simple.IsSimulationRunning())
' @( D8 n# y& r5 m6 ~6 i @. S WScript.Echo("Simulation is running!"); : V' A- {0 U4 {
: M* u% v3 }( y. N4 C5 r
// Wait until simulation is finished
$ l# z& X6 w$ N: owhile (!Finished) WScript.Sleep(2000); . ?2 T( F; s4 E, g: b- A6 p. T% V
$ Q. H" S& C4 h& n0 }simple.CloseModel();
5 M/ I. ?: p6 L* Y! g& k% [simple.Quit(); + b( m" D0 ^3 x
WScript.Quit();
' A! G# `' K' c% {' c2 R/ `1 m
, @. h" W P8 `, X' {* Q# \; ^
0 C; h) K% M; c5 M. n# Vfunction RemoteControl_SimulationFinished() : @ @; }+ |$ E" w7 h
{
- u) ?; c \' K. ]5 ` o WScript.Echo("Simulation Finished!"); |