Example of a JScript
) H: I/ V1 ^' J: f( a/ [* Vvar vbOKCancel = 1;
8 M7 h) Y- v+ @var vbCancel = 2; 6 y5 P. w( `5 a; V3 \1 J' K
var vbInformation = 64;
4 }( L# B- @# T5 J! C0 T7 b' f/ S" ^var Finished=false; 1 F4 M/ m* S+ F
s6 j# X) W9 W* P. e8 }var WSHShell = new ActiveXObject("WScript.Shell");
( C; {8 F u. F* \ 2 D1 _9 l( ^, T# j6 f8 j5 Z y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 v; F* Z5 | ~! u( ~* Q* H # u, H7 ]7 {( w% I7 K
simple.SetLicenseType("Runtime"); ; G6 h; E: S8 u7 G9 y
* [& D6 J8 r1 G5 e6 y
try " c5 I: C2 t' Y$ f, l4 _
{
7 S- P) ?, v( i // Enter the path to a model file!
* }' ^" d# V" |! T0 Q. l3 ` simple.LoadModel("C:\\Models\\Test.spp"); ' |/ m( b6 G3 c' k
}
' X u: \4 R; ?5 Vcatch (e) / U+ [, M1 z, c4 M( }0 }
{ 1 `/ m( v, R* D H% l% _
WScript.Echo("Could not load Model!"); ' c' L/ n0 D+ k0 Y/ z3 K$ m
WScript.Quit(); 2 ^) O4 F3 [" L3 a
} : b, G* r* N! c& e7 X( g! D6 ^1 w
, K Q# {* r5 o7 u( U; Stry - }# s# V8 U& Z! Q& i# f
{ k0 p# S- {( f* x2 A6 ~" @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % f3 q/ I: g( T0 t ^ E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + x/ U* I, N7 H
if (r == vbCancel)
$ z8 z5 h4 q0 n: i3 Z {
; c3 p, |/ G- J0 d! L$ e3 F# M% i simple.CloseModel(); 3 ^2 `+ F: Q( {2 X( j" y
WScript.Quit();
; v3 h M& \0 _$ V: L9 T }
6 a* e$ k1 x- W) X} ; ~6 r/ w" m2 k' \8 V
6 J2 |5 J9 w5 E! \* U
simple.StartSimulation(".Models.Frame.EventController"); . N# \! z! s8 l
/ s& X# L9 o# N$ K _2 ^if (simple.IsSimulationRunning())
8 K( B+ i% v. G5 Z$ C$ J9 d WScript.Echo("Simulation is running!"); ! I8 s8 v, J0 A
9 u7 q& \ a0 }3 \// Wait until simulation is finished 1 C6 H, Y0 I, J0 N! _. v$ Q
while (!Finished) WScript.Sleep(2000);
1 J1 ]3 a, y# ~7 a9 p1 v3 B
3 ~* ?' y( v* L: [2 L* o5 F3 q5 ]simple.CloseModel();
' g9 {/ z% Q y7 e/ w/ |& k$ N tsimple.Quit();
3 x, y" M# S' v, N1 [% E; PWScript.Quit(); $ ~2 ]5 E8 _# `8 O1 e
. Y A3 ^* f* p4 K7 I2 i2 o$ w
4 k6 @3 c: m7 C, w9 I! Ufunction RemoteControl_SimulationFinished() : D: B! h: ]) o, `- Z3 ~6 ?
{ * ?! R9 l( a3 Q
WScript.Echo("Simulation Finished!"); |