Example of a JScript
6 F. P4 y! ^7 r1 s; l6 p2 _+ jvar vbOKCancel = 1;
0 C0 b! E, I* y( lvar vbCancel = 2; 0 q) s( n0 |) @9 `3 K1 r1 G
var vbInformation = 64; 9 I% s" [& f# ]
var Finished=false; ' @: D+ R6 f* q8 L. `( g& [: ^8 ]
: s" X& W0 B F/ x
var WSHShell = new ActiveXObject("WScript.Shell");
! r9 k; P+ C X: d' o
^+ [1 s) j7 y/ Uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 c6 `1 S- _- f& t$ \, I% J
, S) ~1 m' m) H% zsimple.SetLicenseType("Runtime"); 9 i# ~7 k6 ~# L
' T8 G4 }, k8 V& T: U3 s0 c- j0 g u& c
try 1 m: o$ m! o0 j+ Z
{
$ a1 T0 f5 B4 M A5 a! Z! X; u // Enter the path to a model file! ( N9 n6 x% |) L
simple.LoadModel("C:\\Models\\Test.spp"); * U" n* T! w5 U. B6 H$ P
} ' q3 L A1 |1 z2 {/ R( _0 X" v
catch (e) 2 V# t D3 I. Y/ n- `0 Y
{ $ ?, T) s7 a& @& C+ J
WScript.Echo("Could not load Model!");
. @4 A+ m1 E, L; L R! G" o WScript.Quit();
s3 Y5 \; v+ }# Q- n+ R- o}
! W0 `. j& y$ h' G7 j 6 D8 L ^0 m7 U9 s0 _) y
try
- T8 Z/ _ d7 E1 q! F7 K. m A, z{ 3 E+ ]8 z @9 i; r& g* k1 Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ {/ {: v% I) E. B% n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + E; e1 U, {6 X7 T+ e, h
if (r == vbCancel) ' Q! e2 [! J$ p/ c" u- h) U3 b
{
. C X1 S; K" ~7 X+ s4 Z simple.CloseModel(); / |. M* P3 M& `1 |& p3 E/ X
WScript.Quit();
7 e, L! H% }; C! U" _6 q }
) y" J2 H U: n1 o8 {/ A} 0 P8 L0 U6 t8 b* M1 ^; \" t
0 c. T7 f' J F- p& k( R1 U
simple.StartSimulation(".Models.Frame.EventController");
/ i2 y( L a+ l$ k) H4 [
% D+ j3 q4 j) Jif (simple.IsSimulationRunning())
7 C1 }# ` c$ O" c' t& U: x$ c WScript.Echo("Simulation is running!"); - S2 C h5 D4 q/ M- m* s( g
$ I) v$ Z, v) y, u2 ]0 q/ B4 B
// Wait until simulation is finished * {( x) S7 M p( w3 r7 C) K: K% k
while (!Finished) WScript.Sleep(2000); - \. {" {3 a' e1 E0 S+ e4 g2 r5 Q6 a
, f5 U& v- N( H0 N
simple.CloseModel(); & i, Y6 w! B5 C6 x
simple.Quit();
, c0 `: q2 ^% WWScript.Quit();
. o: c+ Q' M- N# @8 S0 m! Z: B ! Y$ E/ h4 e$ d9 C, J
3 g6 g0 B* G( X& |; M" c/ |% w) sfunction RemoteControl_SimulationFinished() ( \% k8 W4 ~3 S& \( _/ D
{ s3 m# w+ x1 Y6 C# j
WScript.Echo("Simulation Finished!"); |