Example of a JScript ) O1 B# y+ V" r% [, {" V- d: ?
var vbOKCancel = 1;
4 f3 \8 s& E p% E7 C& }4 Wvar vbCancel = 2;
( B- B% w' V9 J, y$ xvar vbInformation = 64; 7 m+ a* v8 E6 z4 X; j: \
var Finished=false; 0 @. t/ j7 p6 n
: p7 ?+ q1 N* K! R* U% E
var WSHShell = new ActiveXObject("WScript.Shell");
$ `! _ x4 D( ?. _; Q+ i1 i* I# X
9 j6 x9 V1 R8 Y; {" u' Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) a2 q( ^% [( I
# p2 i2 c' w8 [1 C
simple.SetLicenseType("Runtime");
1 x( a- R/ {( D# n 7 D ` o6 H6 b7 }1 L" [$ i
try
7 i; \9 g8 w, L* Z" b{
0 i! {, `' @" l0 g& z8 w& h5 y // Enter the path to a model file! 8 D1 \* H# Y) K: n( @
simple.LoadModel("C:\\Models\\Test.spp");
: a Z3 y# J7 {9 e1 l& R1 B}
3 Q/ R2 t2 p6 vcatch (e) " L& a7 Y) b; u8 e% a" q2 R
{
: _1 X; n" F% n$ ~1 z* C# h8 [ WScript.Echo("Could not load Model!"); # K8 Q; w7 p. E
WScript.Quit();
6 c8 j# O' u- t# r2 ~}
9 M1 Z" n1 K3 n) l# X- F+ T6 C * t( r6 h+ Z' m* B
try 0 |# a- l$ _9 u/ x
{
% d3 O* J0 l4 y. R) _7 y' i simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( R" e$ U* h/ J4 x/ P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 H. v& e, O. T1 [
if (r == vbCancel)
8 ]1 ]0 H, `' ?7 {5 I. q) H {
. T0 }/ ^3 C5 {0 Y% D* [ simple.CloseModel(); ! L: Z1 k% S. P5 E; q+ U9 x
WScript.Quit();
+ o) r0 l) b8 j; w }
0 a, E H8 b# M- I8 k8 k} & R* n8 _: V, S! X" }
- F. i. a' i" ] p
simple.StartSimulation(".Models.Frame.EventController"); ' s7 ?2 P$ @$ I
" G7 F' U1 [! b6 oif (simple.IsSimulationRunning())
8 b+ v5 J! o/ W9 @1 r J& @ WScript.Echo("Simulation is running!"); ( ?( f$ Z/ P: n: N Q L$ \
+ e$ h- }" W( \! {6 N! `! N5 S// Wait until simulation is finished 7 `& L% P5 g1 X9 L6 D6 S$ a* b/ X
while (!Finished) WScript.Sleep(2000);
1 T. K; q! R, b- J- F& Q
! }! |7 F- D) Osimple.CloseModel(); 2 z. |6 P! H2 ]4 L o
simple.Quit();
' F$ `6 K. }2 N: F' b- ~WScript.Quit();
; h/ D: S) U& e2 ~; d/ k
6 ^. ~' H7 K5 j- x* ] ! j3 b R3 K. Q$ e& y: c% O
function RemoteControl_SimulationFinished()
0 e6 b# k e3 B5 F7 _{ . A* y h M+ k7 C# y
WScript.Echo("Simulation Finished!"); |