Example of a JScript
3 R# ]" [7 G* [$ l" {7 h1 t; Xvar vbOKCancel = 1; ; S+ }2 |! M( A+ O+ g8 J$ P
var vbCancel = 2; # U2 p% y0 {# U# c" D9 d! {$ y7 T
var vbInformation = 64; + q2 y: _3 p0 F4 D' R4 A
var Finished=false; 9 S- Z2 s4 w0 U2 k
4 K4 |+ [2 X8 _9 }% Mvar WSHShell = new ActiveXObject("WScript.Shell");
6 [; B# t. w, _- Y0 O( a8 ~0 w
9 w0 e* U9 W- c& ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ u. Q0 o, S2 X; r0 Y, P/ ` - v" X& r+ @7 p
simple.SetLicenseType("Runtime");
- i; y6 h, p2 G7 m 1 @2 y& f. z% ^2 p5 p
try ! V5 Q# Q1 F5 O# i& H
{
1 N" H! e4 k2 ~, ?/ Y9 t% x // Enter the path to a model file! T0 t s3 u# a$ ^2 B
simple.LoadModel("C:\\Models\\Test.spp");
+ g- W$ ?# K+ n- _+ |% m) o8 s$ h} 1 u3 D! g" E+ [. e
catch (e) 2 Q8 p$ ^% i" s1 o! l
{
& I" b v. S: \5 q: z+ x6 i( i# s WScript.Echo("Could not load Model!");
/ i( B3 }0 `+ P0 l: I& F3 {# I WScript.Quit();
2 `' W2 t. q. |) f! {& l# M* m} ) P( Q7 b) W [* ?' R
" i7 Z! _3 ?' @7 u) r$ Gtry
. _7 D' K. {8 h5 }" } o! n{ 7 m! {' N2 z' i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + g1 V, P3 ?0 A* V+ ~* P" e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' F% {+ A$ k/ Y' g* K0 H6 k
if (r == vbCancel) * W J: j, Z9 Q; ~
{
* m. N+ _4 U1 H& y3 ~6 B simple.CloseModel();
% o! \1 e4 Z: j t& q- h, Y WScript.Quit();
V0 |: U; D- |7 N5 G }
5 J" {6 A- m# Z l# F* s3 h} 6 A( u2 `: M# E
* [, T! A, Z# y$ jsimple.StartSimulation(".Models.Frame.EventController"); . ? |. v! B0 t% ~' m
3 n) t0 P! e6 d& u# C& z! aif (simple.IsSimulationRunning())
4 h/ z C" }0 \3 [) _2 G WScript.Echo("Simulation is running!");
! p* y- n7 Z# C0 s
' _) k4 t- W0 q W4 u// Wait until simulation is finished
& @- ?$ S/ I' D* A, Pwhile (!Finished) WScript.Sleep(2000); # w. T6 [# f; [$ X! m( H; d
& `- _4 W W" ]$ Q5 z! {* V6 vsimple.CloseModel();
+ p/ D2 ? A" nsimple.Quit();
/ O& K5 p# u( R" r* @5 U- wWScript.Quit();
: o& s, x1 H9 X" `) \ - f$ Q2 E3 o. A% ?& r1 I( ~
, f1 Z" \: T1 Vfunction RemoteControl_SimulationFinished()
& T6 v# \! f% }# y- C% ?{
4 \" r9 @- k% ^: i/ R4 o WScript.Echo("Simulation Finished!"); |