Example of a JScript
; @- A5 b {. x E6 Kvar vbOKCancel = 1;
( i o% l4 M7 a/ d; mvar vbCancel = 2; . Q. e; _. s0 x
var vbInformation = 64;
) X7 p" Z! I4 V: m8 }' |var Finished=false;
+ S" {- R* k. Z* `4 k+ C
$ x( T) m$ }& }9 x1 I$ {% fvar WSHShell = new ActiveXObject("WScript.Shell");
" V! P8 c3 I& H# @ 8 w6 P7 C1 B5 j$ P( W" H4 J- C
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- r- |& l* [& C( W9 P 1 s) B5 ?( Z! a( P
simple.SetLicenseType("Runtime"); 1 N( i0 p3 W- A7 ~
, B- X# _# z/ x: p' n* {; _try
. a7 S- X2 e: {% e: w' z{ 6 J/ x8 W( x. i* E6 V- A. C
// Enter the path to a model file! 1 S$ o. B6 ^7 z8 g; g" ^
simple.LoadModel("C:\\Models\\Test.spp");
; ^0 P$ M5 T6 K x% `} - l. N9 @. E( W' x
catch (e) " T- A3 ?0 S$ j. h+ P
{
J) |% O9 l( F) |: Y5 Q/ W WScript.Echo("Could not load Model!"); # v5 o: z: ] K' B. j% J
WScript.Quit();
$ x+ g) K6 k9 ~) o' T$ N} ; W. m$ f6 k1 ^, H& Z. a. e
. H3 s# }( P2 g2 k2 q3 s5 I s
try 8 l5 N I" p- R# V
{ # Y! \* P4 R. n) O4 A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 L7 Q7 o. z9 V4 S o# X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / X3 k5 J- Q* J2 A3 c& H
if (r == vbCancel) * u6 _# E/ \5 U- p) }3 J
{ + F# w# c& I( d) V1 H+ |0 K
simple.CloseModel(); $ ^: `9 e7 ~3 j$ ^ {
WScript.Quit();
" v0 p: g3 N6 g. k K$ Y U9 T! C4 e }
- t" Q1 k0 W% ?, d} 3 j4 t. n& ?! n4 u4 X+ C! j
/ A0 Y! _8 f7 K
simple.StartSimulation(".Models.Frame.EventController"); 4 ~$ z; o) k3 N& b
) m! Q6 g1 b2 k9 ^2 y
if (simple.IsSimulationRunning())
# v" C5 ~% }6 G; z WScript.Echo("Simulation is running!"); 3 I" \) N$ j/ C
. G4 h; T' o: d0 b" ~7 L$ f. a// Wait until simulation is finished ) l( e& t Q( a8 w( z1 k
while (!Finished) WScript.Sleep(2000);
: G$ A, P: `, p5 @4 B. y7 S U8 l
8 m& Y5 C! p) q7 _5 _; o. Z2 M0 osimple.CloseModel();
; i4 @) L. x. W# x" \simple.Quit();
% M+ C" ^+ Y* `8 E6 I: xWScript.Quit(); , p% _! W7 X7 Y2 Q: F
8 @2 p9 c b9 K9 Q: A3 _& K( H# l 1 f* n' u: G0 w5 w+ x4 i
function RemoteControl_SimulationFinished() , q2 y7 \. Y, r
{
# q8 I. S6 R$ o5 i% K6 L; z WScript.Echo("Simulation Finished!"); |