Example of a JScript
; U1 T: B L+ E" c! ^var vbOKCancel = 1; 6 R& f; `$ R/ c6 \; Y' |
var vbCancel = 2;
" Z% Z) e# U0 w0 U5 W* C! T- e; qvar vbInformation = 64; * q! }+ ~: @3 w. y7 p v
var Finished=false;
* ~$ {$ E$ m9 e" `" h/ G0 p5 d
# C3 o! a& w, U. `9 ~# _var WSHShell = new ActiveXObject("WScript.Shell");
9 D( E( m8 ?+ }0 q4 f8 w ' P" k" h7 ^' o1 x- w7 i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- ~- z M# `% o4 u c 8 F' C/ q, R8 h/ s
simple.SetLicenseType("Runtime");
$ _1 U9 d" Z1 D9 o& s. K' g ; j% V7 l+ l3 @1 C& d q6 `' s
try
6 F$ F1 m3 i7 ]7 f{ 8 x7 p. R' w6 \* f- C
// Enter the path to a model file! ) M1 U1 b6 U5 U0 h: S1 r
simple.LoadModel("C:\\Models\\Test.spp"); $ T/ _- U" T! _: P" O' F. ]
} 5 @$ r9 t' B2 y7 K' V: t# B
catch (e)
- `. Z. q7 O6 H' H0 N4 x{ * N B# r& d Z$ l$ b0 x/ i# ~: j
WScript.Echo("Could not load Model!"); + M) M/ Y* ~# g* Z
WScript.Quit();
( {2 Q( |9 l h} 4 \! }$ ^+ O# y" \" p
9 {( C+ v% e, u
try
. u6 ]- }4 l) q* b- u/ E+ b* Q9 a5 r{ 4 }/ j4 S ^& ?& C7 @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- U, g; c; N& Y0 A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 f1 i7 u; d& F8 x6 I- I
if (r == vbCancel) 2 [/ m) T% \ {2 E! X. y) t7 j
{
, e: O/ W* F& R L simple.CloseModel();
! X1 [9 i# y6 x2 K' ?, B WScript.Quit(); * f, E) c1 h s3 E3 x9 G/ {
} 4 D. C& }/ a' |$ |4 M* h% g
} " j# |0 {8 B: ]/ C1 o
. F% {) b; T3 F2 T3 E7 O
simple.StartSimulation(".Models.Frame.EventController");
; S$ D2 i1 O! [2 u4 A! T9 S* c, B
: B" ]5 a* s, p" Eif (simple.IsSimulationRunning())
: J0 L" g, i9 Z$ A% s% K, s& J WScript.Echo("Simulation is running!");
9 }7 | F$ w# z% u. O( D7 G* u
" H3 a' I: g) b// Wait until simulation is finished
' d! y3 V1 n. d8 Bwhile (!Finished) WScript.Sleep(2000); * a. H! Y! \. w6 P
, z3 y( D7 b* e- m" h
simple.CloseModel(); 3 Y8 A/ x( B0 q. _
simple.Quit();
* a3 A/ M3 G- FWScript.Quit(); & J9 D# n- Q4 }, m
8 X( I5 r- e, E! _ ) z/ q0 \+ \0 c
function RemoteControl_SimulationFinished() , R- p" |$ Q" s C. N2 \- ]
{ ) n* ~( z# Q" d
WScript.Echo("Simulation Finished!"); |