Example of a JScript
9 D( u, i$ ?$ Evar vbOKCancel = 1; F' F* f% B5 y
var vbCancel = 2;
0 t' Z" y% G0 v/ Y9 z# Z# Hvar vbInformation = 64; ! S7 z: o8 C5 u2 G$ p1 a( s3 ~! h
var Finished=false; - r+ H5 l7 H# D$ ^' x
- d7 j$ [. v- t7 K' R. o
var WSHShell = new ActiveXObject("WScript.Shell"); K' g! `+ a$ P) B
4 x- U. U! O, |' L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. y. [* e: c5 n" s' j& p% a % M9 i# V* y( F$ o
simple.SetLicenseType("Runtime");
0 u, b C! f$ F; l7 j1 q& s
0 M8 g0 A) x' p4 i9 @' mtry
) R3 r2 `. w; f8 k{
7 l, b8 [0 l" w, U F# \0 a) `* B // Enter the path to a model file!
3 [! G2 }3 N0 }' Q# Y" n simple.LoadModel("C:\\Models\\Test.spp");
. G$ B- i8 E$ `}
5 C: i& d$ F4 u! a( v; bcatch (e)
$ p! s$ h# m% [' c( m" s* S) i7 L{ ( j* W: O. p4 M4 I% P- f
WScript.Echo("Could not load Model!");
" k9 ]8 R, t) U WScript.Quit(); 9 L7 N; M* o5 I
}
/ D( x7 X& b$ Q% a ! r. K; L+ I0 N* \% |
try
1 a) F' t0 ^( M9 D% H; h{ - {4 w) R: f- s* d4 T) Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! ~/ R3 \4 o0 m5 T8 e, |# ~ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 f' y9 F) b) S/ f/ C+ o+ B. D
if (r == vbCancel) * g/ N. ~: @# l! _, a0 Z! f
{ 0 N4 R5 W8 R' q' j
simple.CloseModel(); % q" d0 M' y# @9 l; g
WScript.Quit(); $ C% ]/ a- \% L
}
) g" X# ~. E% [1 _3 u+ x} # n- Y- X; q, K# `
1 R* E* p. N* {; o
simple.StartSimulation(".Models.Frame.EventController"); - x6 c8 n% j: G) u, S8 h
( R, I6 o, @* q( ~# c2 X- eif (simple.IsSimulationRunning())
9 i+ E# [# r8 b0 n* E2 ?1 \ WScript.Echo("Simulation is running!");
- R& N7 A8 T) [9 t# b
7 r9 x( _9 L1 o// Wait until simulation is finished
0 i5 W0 Q1 c; m; v: Q" @" wwhile (!Finished) WScript.Sleep(2000); 9 ~% L9 Z) o! D3 P
, x$ K3 o0 P% ^* E& ?% B) S usimple.CloseModel();
3 Z5 l! Z; U+ j" |4 Usimple.Quit(); 5 J6 P6 l( H) s- J, A
WScript.Quit(); & ]# h7 s) \3 r! V# b# g5 d
) M( @! |6 g# e + q h! C) M. t5 }3 s
function RemoteControl_SimulationFinished()
5 T0 ?6 a6 |( }8 F{
# _$ S' |2 j2 X WScript.Echo("Simulation Finished!"); |