Example of a JScript * @" t$ Y( x9 ~. s- g
var vbOKCancel = 1; ; f8 y5 N# p: u2 {* @0 I
var vbCancel = 2; 9 f8 J& f7 H- _
var vbInformation = 64; % V6 Y) M3 \0 x E, p' N& Z+ s
var Finished=false; 1 y- t* m1 ~: {7 T) R- B/ e
+ Q" j& d* n6 @, L7 Xvar WSHShell = new ActiveXObject("WScript.Shell"); 1 q {, O3 M* A. A6 P
6 t5 K0 D6 A4 |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; Z, M, m0 x; ~
7 L7 T! K- {1 l, a3 }7 w2 u. asimple.SetLicenseType("Runtime"); * z2 L' W. i U+ Y/ R5 |: K
9 y# @; d4 E8 Q- r$ w# I x: \) `# M
try
3 t" k) [0 e( q{
8 l& Z$ X8 y* e: m9 O // Enter the path to a model file!
b2 L8 R/ P1 K& h# i. Q7 _" Z' F! E simple.LoadModel("C:\\Models\\Test.spp");
9 B3 C+ `$ U( n} ( b. n9 @$ p. W% K5 N1 B
catch (e) 3 g ]4 ^& F$ @2 [
{
; P2 v! y1 D5 Z$ j4 s% q4 |( z WScript.Echo("Could not load Model!");
6 O2 n) e6 }$ X7 Q/ \ WScript.Quit();
, f8 A) W( C, W) @2 F2 E}
8 v0 V- W3 x2 l/ h- ? ' |; r6 {3 f! x, M2 A! J% B
try : ? ^6 ~0 G; D
{
: |! R# G9 b' l6 J" l simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 L) K$ w9 A7 t. F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); r$ t% e" h3 A; p+ z! f% `5 i
if (r == vbCancel) ( { P1 j$ n; j( f' K# q* l7 }$ ]
{
F, ]# Z) o$ |: ?; V9 `: v simple.CloseModel();
6 t' H% E! P* C- B8 n* |7 Z WScript.Quit(); " r$ Z5 ^( Q5 n4 L* d6 w% ]
}
" n& V6 r2 x% T6 N}
' n8 E0 `5 R2 Z
1 ~- G- |: ]! o1 @- F, jsimple.StartSimulation(".Models.Frame.EventController"); 1 b( N! h7 R" L: i
; S. w8 h' b! ~/ I% N+ x# A
if (simple.IsSimulationRunning()) ; C1 i# W) d5 J$ H) K0 w' O% S) [( K X
WScript.Echo("Simulation is running!"); ! l) M' b$ v! \3 r+ \, m: E
$ S, h* R W9 T5 n5 c4 g2 U4 r
// Wait until simulation is finished $ C3 H) s" h8 `: F1 h
while (!Finished) WScript.Sleep(2000); 3 `) h9 S& p0 e* Q6 Y
; G# ?! {7 Y0 ^$ Q Esimple.CloseModel();
# ]2 o# l+ Q& B/ K9 g# Usimple.Quit();
# i! o& a% \; r3 r0 ^WScript.Quit(); 8 x2 E0 R l3 N; X# Q
( d8 g/ O1 A$ `! k$ H7 j: i- l9 o
. D0 T& m) z9 c; \
function RemoteControl_SimulationFinished()
S5 z% l6 E& |0 ?7 s{
; o) t& F" P, @6 F3 m) S/ v( u) ?0 D WScript.Echo("Simulation Finished!"); |