Example of a JScript
. h+ X* t. c& I" w" ~9 cvar vbOKCancel = 1; % x1 E0 h3 b, }0 U6 i/ Q
var vbCancel = 2;
4 \6 R* r" O5 K8 r5 L: pvar vbInformation = 64;
3 D9 X7 A' T, a* Y6 e# Nvar Finished=false;
; I% f4 e+ M7 P' L2 s 4 N8 a/ w% m. j* k2 k
var WSHShell = new ActiveXObject("WScript.Shell");
7 a4 f6 ^6 U; P" ]0 H 1 L+ |* Z$ m$ t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 ~, w) t9 {' x$ Y3 r 9 H: N2 u; _2 k( i+ ^
simple.SetLicenseType("Runtime"); - F" d! O- G) B& o: i. Q- a
0 Y* w m& Q( I9 v" G" c9 M1 |, Z
try
* F- ]% w; c1 ~ a{
9 s, q# F! f% H6 y6 {: G1 n, Q // Enter the path to a model file! , {% D( @: Q1 \2 n9 \ ]6 L
simple.LoadModel("C:\\Models\\Test.spp"); 3 N9 L: }, M8 {" O
} % z8 V0 D3 ^$ G, n) J) R Q# z$ x
catch (e) 1 m2 ^! z* v. s
{
) o5 ]* j+ A$ c- B) }, e: H0 B WScript.Echo("Could not load Model!"); . u# A4 _/ [3 K
WScript.Quit();
: F! e: t0 ?) \4 P2 Z. p1 n}
( U4 |- V2 v2 `( m$ x3 ?7 \. c% |
) g2 h% ^) s/ N$ B2 D7 U; Ctry
8 o4 f2 r1 i8 k$ w5 {1 b{
* }/ O! g) N. V: e7 H4 G( o simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, x$ z) f" e7 X; T" M' t3 @! ~" Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 F9 J* M l4 @
if (r == vbCancel) * ^- ~* p3 L9 `* Q9 {
{
0 N* |; `0 |! M. Y7 E. y, I simple.CloseModel();
( }- ]( X/ |9 ^# | WScript.Quit();
4 M* t+ r0 \2 Z/ _ Y } + V! p' B) |) [$ L6 A8 f+ r/ `
}
: H) u" F/ A$ S) a" R
5 w# ], b: t2 T2 Y: d+ U( [simple.StartSimulation(".Models.Frame.EventController");
, T7 V3 Y, H, V7 _; a A
$ V V. }' w5 n0 I) E2 }if (simple.IsSimulationRunning()) 9 F- B$ O; X2 S$ X( T/ Y+ w
WScript.Echo("Simulation is running!"); 8 G, `- y/ j& U* p& M
) d0 [- C/ Z' `* h. Z2 D
// Wait until simulation is finished
1 @4 E; [7 E3 p# x+ j" `8 ewhile (!Finished) WScript.Sleep(2000); + z- z# H4 S- Y# P& }
1 @& B* Q& a0 Y
simple.CloseModel(); . a f0 E Y1 I
simple.Quit(); * [: @& ?! g, Z+ e& {3 Q7 T) L
WScript.Quit(); , c# o5 ]7 _$ S: N `
$ y. A9 ]6 a/ p E( R, T- u' |# I& q 8 t& n: d5 e$ E: z
function RemoteControl_SimulationFinished()
! N9 u2 l, U; N{ ! T$ d. u, o+ }) Q+ p4 Y. U
WScript.Echo("Simulation Finished!"); |