Example of a JScript % `: R! Q7 a9 E& K9 K4 c8 x
var vbOKCancel = 1; ' M0 A4 V5 t- B5 f1 u& w
var vbCancel = 2; . ]( L- S3 }: ]8 `% F) }% ]
var vbInformation = 64; 5 X @' t1 O4 L) } b
var Finished=false;
% @7 V- ^7 E. s3 l9 h$ a9 { , B7 l9 U# ?, Q$ D# L' M% h
var WSHShell = new ActiveXObject("WScript.Shell"); # ~+ ~- j' F% j7 E; U7 y6 L
' O( s- T, T" _: _
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: K$ G* p2 }) V8 p ' n1 W8 {, i7 ?5 _
simple.SetLicenseType("Runtime");
% w/ \1 _4 T: G. L8 ~6 ^
$ @- x3 Y8 _; B/ ?1 Vtry
- G7 n* X9 i- y2 c: u3 J1 n6 l{
' G+ W/ Y* v. n7 l // Enter the path to a model file!
0 G( ~# c; k h" y# f, N/ r simple.LoadModel("C:\\Models\\Test.spp"); 7 N: h) w7 ?6 {* {0 k/ b7 H; ^! [& p
}
/ _2 j4 W' y8 y7 ?9 D$ e& Zcatch (e) ' j9 L b/ d9 E. |% F) A6 U
{ 0 H$ B, a/ m" _! J: T
WScript.Echo("Could not load Model!");
: E1 p I. E1 O2 Y3 x+ N# D: v WScript.Quit();
' t8 |. w, R; G/ u} 7 E1 R1 F( ^0 m% a1 p* Z( p5 i
: D7 U5 ^3 ?9 m. I8 O" N
try
7 R( J% n- f, Z+ Q' h{
. f3 r4 f; B3 D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; z/ Y- Z( B0 L/ B% h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 r; { j( ^, s: p7 K
if (r == vbCancel)
) k- i2 g i: N7 g {
9 M3 t/ S! s* v1 i: e simple.CloseModel(); 7 X4 ?! m8 Z$ \% g6 v) [ B6 _
WScript.Quit(); * u% L) b( t6 |) H$ @
}
1 r4 \! T5 w8 o& h} 2 t* a8 P b, v7 N v
7 G0 l! d4 ~6 T! L, ?0 Dsimple.StartSimulation(".Models.Frame.EventController"); ( \! b6 w% G+ e+ d0 ^
$ Y9 u$ |& s7 X; _% @if (simple.IsSimulationRunning()) j f: |3 g& d4 w5 {
WScript.Echo("Simulation is running!");
1 A' n& ?% P3 }8 y9 d 8 {5 P3 \" r2 q1 N% Y
// Wait until simulation is finished
& z% P% i$ L9 m& T" Wwhile (!Finished) WScript.Sleep(2000);
& S4 C5 P E* `8 t% h! H2 f3 _: t 3 l, J0 c) H/ p3 g8 ]- s# r+ f
simple.CloseModel(); 0 i. T- \- V5 |/ ^8 i* q
simple.Quit();
2 m+ @. K! I( o$ J4 C0 [( WWScript.Quit(); ; F. b: y9 R9 v; b% _/ t
8 E& E. A0 E( I: _7 T
% T! `% a; T" R/ k- ^, E8 \function RemoteControl_SimulationFinished() # @. r3 u. i2 J
{ & p4 q2 ?+ g' C/ {% A
WScript.Echo("Simulation Finished!"); |