Example of a JScript - h2 {5 \2 f+ b9 i6 N
var vbOKCancel = 1; : k6 d8 t0 r! A/ G% n" M
var vbCancel = 2;
/ {1 ?$ Q% A6 J) s2 d- G( d% x" evar vbInformation = 64;
) l' z; A+ b. F4 Z9 Q& Uvar Finished=false; ) ? V6 R9 R+ g) w
, d+ i; w! c/ q* p# `5 B
var WSHShell = new ActiveXObject("WScript.Shell");
8 w, U' y5 P4 s. @& c
8 ?# k) ]7 @! Y/ q9 Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* L5 E; O1 C; g8 [- }; \; k i
5 _# u0 _: _1 osimple.SetLicenseType("Runtime");
2 a- _4 |) N7 r7 Y) ^7 ~ 0 o/ ]. V- Q, d( K5 F
try
7 m# M, J) R: n% I; s0 V% U{
6 P9 q# _8 H5 Y, c; I& f // Enter the path to a model file! / \; v1 Q4 u. Y* T
simple.LoadModel("C:\\Models\\Test.spp");
$ S0 d* D" n/ [4 o" b} 9 a, Y! E, K. c% J! v! n
catch (e)
7 x. G2 ?; U- w; g7 S9 {+ W! p5 u{
/ W& x) t6 `7 |2 k9 Q$ u2 Z3 N WScript.Echo("Could not load Model!");
7 h a b3 ^. C6 ?+ N WScript.Quit(); 9 D3 [, N) c/ G0 V2 Q1 J6 w
}
7 T) }9 R& L0 x. W d5 y
: }1 u2 ^6 z: Qtry ) Y: t# W$ e, U0 u6 ^* T/ U) M
{ - t7 e; w3 N1 _ `
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! o* I) k, J1 C) K5 h ^5 x' u3 s
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( g1 ]( D; J, z# q. w2 o/ `" d: f
if (r == vbCancel) , Y. z; |% h, a/ g# r
{
, e. f9 j/ D% {( C2 _ simple.CloseModel();
( B2 b' k# {6 W6 |7 B- J+ [ e WScript.Quit(); 5 ]/ u7 a+ D- P
} * S1 ^+ G# A: V( j
}
1 K3 A" s4 v2 M( o4 _ ( l O+ R0 @$ q6 ?9 H
simple.StartSimulation(".Models.Frame.EventController");
/ A( X7 s9 v9 b 1 s* h& H& u c9 R; i% v* \2 X; Z
if (simple.IsSimulationRunning()) H" `! m, `4 A# x
WScript.Echo("Simulation is running!"); ! W$ R% [1 T6 Y- B* H9 j
/ [3 ?- `8 t9 q! X6 v, ]
// Wait until simulation is finished : I9 U, X! G# B, G, |
while (!Finished) WScript.Sleep(2000); ' P8 ?4 J% I9 q* Z( v3 w3 G1 w
4 h! K3 J9 r6 O* s" R ]simple.CloseModel();
m% u4 P+ f1 S3 h# S# [; R# Msimple.Quit();
! l4 b0 \' t" J7 S% b7 k( T0 |+ b; @WScript.Quit();
5 s6 B$ y5 x _. j( l) S$ O ) s9 E; w: P. P3 \
0 q3 v# q( P5 Z+ D- Dfunction RemoteControl_SimulationFinished()
& [ w9 S9 v$ R- l. `$ Z{
3 `9 n/ n8 b" z; U5 K4 I WScript.Echo("Simulation Finished!"); |