Example of a JScript
+ h9 j' e3 A+ R/ Bvar vbOKCancel = 1;
# L# \; {' A+ dvar vbCancel = 2; @7 `+ l+ l. s7 I* Y
var vbInformation = 64;
. p* @% T" e/ M3 H3 g& f jvar Finished=false;
# I O5 D0 @+ ~' W% q- a/ | - }) D' n) Y1 S6 S
var WSHShell = new ActiveXObject("WScript.Shell"); q" f# v, W- H/ K: E4 N7 K
+ X- ]: f& \" z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . L4 L: D' }. x9 ^8 a- K0 R* q
7 S; z q" H5 n- _. C% T! c2 P
simple.SetLicenseType("Runtime");
5 w& b6 W. ?, V8 ^2 ?! L, p& U* y
" b& ] j. ?% q* F7 ~/ Mtry ( s5 q' a& r8 n+ Q
{
( {# {' M* x! M2 F1 m* @ // Enter the path to a model file!
: e7 V" x6 H" O5 K! p8 O" |4 I! C simple.LoadModel("C:\\Models\\Test.spp");
8 O+ R* y* h. x3 y8 U}
1 U" q: S3 F9 s5 ^8 A1 Dcatch (e)
+ j! ^* Z1 U6 b& M{ ; A' v: U/ K0 k( Y- Q
WScript.Echo("Could not load Model!");
- A& u9 K" `; M, |& D, D WScript.Quit();
+ `. H5 R3 g S6 B% m, j} / F! X; _/ W9 B: @: o( |
. i: q# R9 }$ f" K: x
try
/ k; Y5 A5 E4 k; f F+ ?# ^; V{
, T" G$ U8 f1 B. G% l1 d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % p; u6 z) w. g( ^* }0 l! Q9 X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - P6 x6 o% D5 B6 u( F
if (r == vbCancel)
, c9 J& Y$ \& Q( a { & \* T6 w+ w8 ~7 H7 g* y8 G% x J
simple.CloseModel();
# Z: o9 j3 t' W1 I) c- A' l2 ^9 u: Y- ? WScript.Quit();
8 J' N" g# F; ~0 b# h; h7 Y, d } $ o/ k+ ^/ [- @' X
} ( R, G: H% {9 `1 Z {6 b
6 J4 S9 F# \; a4 v x
simple.StartSimulation(".Models.Frame.EventController");
& {# @) p* H" K" h2 I3 `3 W' K; E* u
$ I: q; P9 S4 L* i* ?3 zif (simple.IsSimulationRunning())
. g" p+ l {1 ~6 A$ ^) M+ ` WScript.Echo("Simulation is running!"); 0 c7 S1 }/ C" ]
& S! A! z$ y7 q) [; C; W d
// Wait until simulation is finished
3 m$ b4 h$ k- ?. L5 c7 Pwhile (!Finished) WScript.Sleep(2000); . `* }; d: B# Q2 d9 d+ y, E9 X
# e! Z* D4 t& @+ |. c0 ]' `simple.CloseModel();
2 N( C5 G) q! Z" q7 }9 D: Asimple.Quit(); 6 p' `- v1 V, `1 f7 x7 t
WScript.Quit();
* Q( x5 W8 x' n+ X
/ e; ]0 d1 K# O3 |
! o0 Y$ `6 i' j1 ]" efunction RemoteControl_SimulationFinished() 8 n7 ]: K! z( b/ @& ]7 r: o
{ 9 K5 [' g/ p0 }
WScript.Echo("Simulation Finished!"); |