Example of a JScript # n, w2 k: |' ?3 b5 W Y% v
var vbOKCancel = 1;
# n( k2 Z+ k% X6 x2 D, fvar vbCancel = 2; 0 A; o; {" m' D D ?
var vbInformation = 64; o$ v. c" k( c. {- s1 ^4 Y6 v1 |8 Z
var Finished=false;
s; ]2 j( N$ H3 T9 n( U : F5 w( C& T( o8 I- I8 j& h
var WSHShell = new ActiveXObject("WScript.Shell"); , V$ ? U. i% c5 P4 D/ \( Z+ p- n
: L: o1 X+ f" i- I% rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 s: T" Q q: `' M 7 Y3 p1 C$ {7 m
simple.SetLicenseType("Runtime");
: e# e5 b! q+ \# @3 @4 u5 |2 g ) H, T- V2 G) ~: [& l4 ^, U
try 7 G7 L$ \. O. R+ e# P# U" Z
{
0 ~, S. T% q0 \6 S: J0 h3 t // Enter the path to a model file! - v- Z0 v8 W" K. C
simple.LoadModel("C:\\Models\\Test.spp");
( k u: f( a1 \* _: h5 L& H; I}
: E$ M" R7 t' }7 E e" Ecatch (e) * W. L- J( w( A
{ ( Y- C$ M( P1 j
WScript.Echo("Could not load Model!");
+ t: o% \ s+ ^0 F WScript.Quit(); 3 ^- R$ l5 N5 @: b4 `& @: p- L- ~
} , h5 R3 f; U; I$ z; b7 B0 f1 V
$ C: Q6 L% e* a% }1 Z, o# W, I4 Jtry 2 ~, `( x* k2 G0 i4 r" B
{
2 D7 h. M( `1 X simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 m# I8 @1 W& `& V* { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : {) \9 K. e E1 [0 ^0 h
if (r == vbCancel) 3 \! |1 W' i& d+ G4 j* ~
{
* R) F' I9 ]7 K simple.CloseModel();
- L9 C7 b( a D: i' Z! [" [# k WScript.Quit();
( {) i* b1 w" {$ G8 C- n }
5 r% _3 `9 N2 P2 r; J5 H}
2 g+ [3 m9 e6 M$ T
! o" T4 k$ S q$ xsimple.StartSimulation(".Models.Frame.EventController"); ( V7 a4 j$ M5 H& u" \% X( r
! c. H9 E) y/ { h, A; G; `
if (simple.IsSimulationRunning())
9 }% u% k( V& v+ p& _ WScript.Echo("Simulation is running!"); / P: M& {7 V/ T6 R9 ]* l8 ^
+ T$ |- t5 v: s1 G/ q2 Q. _6 c, l$ ~
// Wait until simulation is finished 0 Z% e) B8 x* B
while (!Finished) WScript.Sleep(2000); 1 I {- r+ A- H6 K+ P; ~
1 S/ S. K) N) `2 Q# d- h5 Isimple.CloseModel(); ) P* C$ R0 u7 D C9 K+ b, K4 U6 ]" i
simple.Quit(); - b0 E7 Z9 b6 [( A
WScript.Quit();
2 c \& `( z# ?" z# J4 n, o6 Z6 U 8 b$ x @4 e9 u- t& G8 m
6 L: R# l6 Y& ] C
function RemoteControl_SimulationFinished() ; V4 c. t2 j g2 ]
{ * A7 x6 E2 @$ P9 F
WScript.Echo("Simulation Finished!"); |