Example of a JScript
4 z% |" I4 `# A- |* |3 Z! xvar vbOKCancel = 1;
2 h z- V; d, T0 A) Svar vbCancel = 2;
) d6 h$ |! H/ A6 g$ _2 u) evar vbInformation = 64; ) g( v' a" b; n9 Z
var Finished=false; 3 d7 Z1 w0 J7 L) G- ]
: `$ o. z) q0 f9 H7 `1 dvar WSHShell = new ActiveXObject("WScript.Shell"); ! W( s% r$ w$ h+ i2 y9 K
2 K$ e# {5 t. m# Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 T- {2 |8 m% @* _2 @6 H0 r" J8 v
: d, |4 @; C6 o7 `. a& ? V
simple.SetLicenseType("Runtime"); ' v4 C3 {! b! N
! w7 \5 M" d6 p( ?: @2 {
try 7 |: F- b1 G& U0 X0 G) E2 m4 w
{ # g) Y z% e, {! ~9 J( F' n" }! [
// Enter the path to a model file!
0 n$ {* D. [2 R/ A/ D P3 l, H. O9 l simple.LoadModel("C:\\Models\\Test.spp"); - B3 T' u' w" H( ]
} - O( L, q# v% k" d& z& p/ {
catch (e) % \$ g% ^3 P/ ?' u8 z4 I
{ - A- @7 H/ a9 J! i- l9 \
WScript.Echo("Could not load Model!"); 0 s6 Q+ g5 x5 }% `6 z
WScript.Quit(); - n y" r T5 K4 c# m% W) `
} : P3 U: h8 P& H, ~1 p" N- Y# x! B
- ?$ Y! G1 [$ t4 }" w2 `
try
! |8 i0 m8 Q: q" h3 w1 j{ " a0 G; Y) Z1 G* |0 E1 o4 [
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * `) t& J" |' U) V
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 o9 ]4 f9 }/ z if (r == vbCancel)
& G2 i5 u. ]: B1 D {
! }7 [3 u3 J' m9 Q1 Z simple.CloseModel(); 8 Z4 C0 R4 h5 G+ O
WScript.Quit();
) i& O% }. Q0 G1 y+ f, K: } } 4 l, M" i, H6 o& f! T' V
} 9 m% }* ~0 u# `
& n; v) t3 U' Y. ~6 A4 _
simple.StartSimulation(".Models.Frame.EventController"); / L$ x5 W8 }7 K2 y8 A" R
) Y o0 ^- e. }if (simple.IsSimulationRunning())
6 s" H7 ]; G/ _3 p% G WScript.Echo("Simulation is running!");
9 X2 V9 u$ q3 r; o6 Q + U& D N$ q _3 J7 J3 w) q
// Wait until simulation is finished
4 I- {8 R/ _- P U( M: C! r$ Dwhile (!Finished) WScript.Sleep(2000);
4 c# K$ [0 k0 w- m6 ]* Y6 U2 I; @6 K * L( Z; {" ~/ h* m5 Z9 T+ M
simple.CloseModel();
% P, P1 m" m. J' I6 x" qsimple.Quit();
$ l, A8 F$ a0 U% g" g& v" TWScript.Quit(); # l8 w6 J+ M( N# f& o
1 O& y3 R+ l: U/ `) K
; g3 [3 n$ A4 |, f! H
function RemoteControl_SimulationFinished() ! Z1 A- P. N2 c3 ]6 m
{
3 ^: H% {' y0 Q$ f2 [5 \8 _ WScript.Echo("Simulation Finished!"); |