Example of a JScript
2 V7 l) p) a4 g) b7 w0 T( |, Vvar vbOKCancel = 1; 1 m; m4 p0 e! C
var vbCancel = 2;
8 k2 j& f- ]$ }2 M* h! d; [ q; D" _* _var vbInformation = 64; 1 j) T# B) |& q7 K0 }
var Finished=false;
) J$ M& O2 T8 G& W, W' m" \ & G4 s; e, x! C& `8 d
var WSHShell = new ActiveXObject("WScript.Shell");
: { c, a, L/ L( b
; p9 H% |8 k/ h( b Xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 N- I; S" |! U. p; R8 b& ^, i
& Q2 h+ E; c w/ g: Esimple.SetLicenseType("Runtime");
8 W6 ~. `& s2 \. i' ?
# `( q; W9 g6 W) G, m8 Stry
9 R3 _* [$ |9 V% B+ Y: }{ + F! U& B! \- j# C3 h
// Enter the path to a model file! # k9 B. p" j3 B; F; N: @* o
simple.LoadModel("C:\\Models\\Test.spp"); 4 `% X2 O& C& t* x _) J$ D: y- s
}
0 m$ Y5 n; B( Y- S5 Scatch (e) ' N4 B. ?5 c" s& `7 _" u
{
' C/ p% c p) K; r. E" V% E0 S% k WScript.Echo("Could not load Model!"); 1 j' E9 m! J/ f3 ~4 g+ Q
WScript.Quit(); ; l8 _( {0 b0 S* q# H( u7 l0 N4 I4 D8 w
}
+ T( k1 h8 ^$ l( `( j$ ^+ G/ x2 r ) \$ x. V5 h4 ]" t2 L4 d+ ^' U* h
try 9 P% p U/ S. F6 t' }, D5 I
{ , @) N7 g, n k- o
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ e l9 Q3 e* ~& c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' X) T$ ^% w) P5 _
if (r == vbCancel)
" q( V: x0 U# @: E: L5 L! h { 8 r2 n, O2 E4 j3 ~5 G* N
simple.CloseModel(); 7 y+ b- z$ b; J/ a! i, y5 d
WScript.Quit();
) v& ^# a8 v8 ?5 \( w }
# w" A& l0 q" R8 O} , b1 B1 @- H/ w3 e4 a0 v. X
) P8 J- D2 t/ G: ~7 Ksimple.StartSimulation(".Models.Frame.EventController");
. }6 w$ ~& v" d4 ~0 R; g" C 4 L% x# e' _6 G9 Y
if (simple.IsSimulationRunning()) 8 W# n" z) N; h9 R7 B4 Y. h$ O! w
WScript.Echo("Simulation is running!"); $ @# b4 ^: Y- b& C# \. }( R z
1 k8 E/ h c0 p, N// Wait until simulation is finished
: u' E. T7 t% |% k5 G }while (!Finished) WScript.Sleep(2000);
$ H( Z% W/ d# a2 |6 H" q4 d2 a( u
t" |( d. {; O4 w( K' ^4 {simple.CloseModel();
8 k7 }. ?# W& t" l6 tsimple.Quit(); & ]! ^7 _- o7 |; n% F
WScript.Quit();
( S$ c( P' O' S ( ?6 X# d7 p, @8 c) l% [
# n1 J0 `6 u" W; J7 v+ \& P
function RemoteControl_SimulationFinished() 2 s% O5 Z9 @2 K* k K
{
7 p0 |# m$ t) L, E WScript.Echo("Simulation Finished!"); |