Example of a JScript # T" X$ ], a; _
var vbOKCancel = 1; . I2 x7 h# K7 X4 e6 u
var vbCancel = 2;
5 v I" L7 K' A% D; Svar vbInformation = 64; * x; M9 q- L0 N2 F* s3 w5 ?; X- U
var Finished=false; ' k" \/ r5 m2 G1 L& B
( B# |% Q( p5 Y) I; a
var WSHShell = new ActiveXObject("WScript.Shell");
6 P$ R+ J; ~1 r2 ~( ^. d- R 5 \9 Q) L, U. s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! _% |) O, ~, F `( [& T
6 E9 I; I- d& g7 u0 D9 gsimple.SetLicenseType("Runtime"); 7 n6 H% [ ~6 Z+ ]& V7 _# b7 h
* e6 t- S \' u5 O
try
m' }$ B. G( z{ ' j2 f9 B8 D. o# g. M7 ?
// Enter the path to a model file!
% n( G7 Z5 A# t* U2 ^1 v" I$ I simple.LoadModel("C:\\Models\\Test.spp"); / b3 k* R. x8 x4 g5 i% _
} ! H, K# A% X/ v" \
catch (e) 2 w8 Y3 u) h M0 c& K
{ 0 }" w n7 q5 Q3 o( b' P
WScript.Echo("Could not load Model!"); # X6 U- n$ S; c! W& u F8 j; K
WScript.Quit();
9 v+ Z3 F8 c4 _3 C1 K}
) c) @: T: V7 m 2 D9 t7 i2 C7 i7 n F5 R! l8 [
try
3 n/ }8 C- Y( U8 }0 N! I5 v{
! a9 F# c2 L9 v+ @+ | simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 v, S1 O3 R1 u( V: o9 P5 @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & l3 X: ^9 j N! O) x
if (r == vbCancel)
* J) o, X# M3 Y' H! z9 c4 B' r9 }* E {
4 b+ d0 D! Q P& i simple.CloseModel();
; E; n; x! \/ v: d( f" f6 v# R- z0 A WScript.Quit(); 4 }# J5 ~) R+ Q
} , f' W; K) U# d' _/ c9 K
} 5 K8 w$ d) G, c; O
2 _& b+ M9 t" y1 r, y
simple.StartSimulation(".Models.Frame.EventController"); + ?# \4 v5 O c; H0 p
& d9 {( C. @+ d! s/ F8 [" l
if (simple.IsSimulationRunning()) . o# e ~4 T+ W* |, Y1 ]/ A G
WScript.Echo("Simulation is running!");
: W9 {: ]/ T" V ' g$ b* k5 r) V Y
// Wait until simulation is finished : ]4 i: P% P) C, i' r
while (!Finished) WScript.Sleep(2000);
, Y( I4 n& F5 g8 B8 c1 y ' Q H- p3 d6 B: K' j3 \
simple.CloseModel(); 3 C' o5 J3 Q; E8 `; U2 Y
simple.Quit();
* d* @. |9 Q- _: T- F+ l$ J7 FWScript.Quit(); 8 E7 I7 Z8 b' @9 M0 P: f4 a
) |0 n* i( Y& c5 m" ^
! h3 i' H2 y# S! n' P8 r- |function RemoteControl_SimulationFinished() 6 a! C" a' d% T9 K
{ 2 p3 m* |& H o$ h
WScript.Echo("Simulation Finished!"); |