Example of a JScript : _6 b1 U0 A5 i3 q* U& O4 u4 q6 D9 O
var vbOKCancel = 1;
u6 m9 b J, a' j: m/ P- m) fvar vbCancel = 2; 6 U1 n/ t; C: {7 J+ p
var vbInformation = 64; 7 U3 f$ ?' E* T0 I9 ?
var Finished=false; ! d( x; a' d) H: J7 U4 R9 b! D
' U/ \7 d1 A( z. \var WSHShell = new ActiveXObject("WScript.Shell");
) [0 n9 t! c' k, B6 e* r8 m
4 I4 w' k) W0 ?0 _( Z! i! Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# z- R( S" z5 k- E. @
) F8 Z* y6 z5 ~simple.SetLicenseType("Runtime"); 1 r, [0 x, F: f" D6 n' V
: m8 @7 Z& b3 ]; E' X
try
: c; v0 g3 e9 Z7 `3 N& i{
5 ~$ K* p. C) f; O; x // Enter the path to a model file! ! `8 v/ X5 C2 K- ?8 o, d. T
simple.LoadModel("C:\\Models\\Test.spp"); ' h f! e8 O% w
} - O- I' |4 ~! D% C
catch (e) % A: O' T1 T, z3 l3 U
{
3 P* L, O8 K5 A# @/ G f) h WScript.Echo("Could not load Model!");
8 I' ^1 `- M; y* e WScript.Quit();
* H: [3 W" u; N) D1 Z- m3 d} : s+ V. @6 m8 g0 F7 R: \& k/ g
+ Q/ z7 l, m- A5 j' l8 U
try
* r- i/ k/ y( f z5 g3 y& u r{
; W2 u- K' ?* [; y+ i% G) ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 t* Z+ o2 J. R- c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - P, ~0 t, D9 i+ m( g5 @
if (r == vbCancel) - E: B3 y2 W/ L/ h( _5 ?
{ $ w0 C( D( I4 |' H! `- b9 F9 F U4 T
simple.CloseModel();
, ?5 B* N, N' x+ f' S WScript.Quit();
; E7 C# G. r6 \ } 3 W' b* b$ n! t
} / o8 q* m) g0 B% G. ^3 W* u7 P
6 }6 e" `$ {0 |5 [' osimple.StartSimulation(".Models.Frame.EventController"); - v7 C6 V4 Q0 c! G1 S, y
7 V! h( z# B: p3 v& E1 \
if (simple.IsSimulationRunning()) . i3 V. |" Y' F# {" P2 i) z
WScript.Echo("Simulation is running!");
# M% T4 G0 _4 \: j3 M% F 0 Q1 m7 ^. `3 t- j
// Wait until simulation is finished
- g5 J4 y7 s$ v Vwhile (!Finished) WScript.Sleep(2000);
7 B# L5 m. V; i" e
8 ^4 D; \0 p/ F2 ?2 ?simple.CloseModel();
" f( Y5 t+ U' p' rsimple.Quit();
8 g( K0 {( \: @' m7 _; [WScript.Quit();
- {" J7 K! O' |% v
0 M$ d8 j( L6 n 5 G# ?* ?" v* E
function RemoteControl_SimulationFinished()
% {& f8 p9 f- o; v0 Y+ M{
/ _/ B c4 Z- e3 r* r WScript.Echo("Simulation Finished!"); |