Example of a JScript
, M* K! I/ o: {; pvar vbOKCancel = 1; " _0 y0 V! W3 C; z8 r
var vbCancel = 2; " @( w9 e( i! U" t
var vbInformation = 64; / b5 H* |+ y8 e; p# [: K/ j; g0 g2 m% `
var Finished=false; : d+ g8 \, ^$ r9 i
4 g9 V/ h1 s7 W/ ?, c( Dvar WSHShell = new ActiveXObject("WScript.Shell");
% P, U2 j0 l- V3 [1 m ! _# ?% M0 `6 [) a
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . X9 O/ J' T6 e
8 ?+ R0 m' H) x8 _* e0 B
simple.SetLicenseType("Runtime"); % ?$ D: t }+ w: D3 \& u
: ?# h& R8 R9 K. ?0 U& }% s M3 K
try
$ J6 ` m1 S5 e6 G0 x{
& W" L% B$ d9 c1 A5 q // Enter the path to a model file! ( B! v; C8 `# f& ~) L- V! N
simple.LoadModel("C:\\Models\\Test.spp"); 1 c% G, W1 D8 P
}
* n7 }" k H; r# a# Ncatch (e) ( w: F/ F3 z3 {6 ^/ I8 F
{ ) G8 L8 X( g& x8 r" h/ ~
WScript.Echo("Could not load Model!"); 3 z0 J- e" i/ H, H
WScript.Quit(); 9 g, b6 H+ b( w1 b3 r6 c
} 4 d; `" c& \8 P2 q) E( c. p
7 U2 A: G1 [8 R2 Q& X
try
' a$ j, o) [/ A7 n) t0 F1 Q{ # M2 u. C% z t- o7 B8 W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & T1 C- G* S9 @2 n S) L; ~! r! M4 R* {
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
h+ q5 b9 } Z1 W8 X2 q! Y if (r == vbCancel) . I& l5 S! |* A# b8 t& B
{ # X; G* g+ R5 {4 a) ]2 Q: f4 [
simple.CloseModel();
0 i3 w: A' B9 @ WScript.Quit();
/ c5 H3 n2 v/ V8 y" _7 N }
! {; Q" W& T- N% }: [, O} & x8 @( \1 \/ m+ s; Z/ R( N
! H5 r% R0 i( @ A8 O
simple.StartSimulation(".Models.Frame.EventController"); 5 m }& W' n" y& p+ a+ `
+ G% p4 d3 T, c: Y E$ V/ a) u
if (simple.IsSimulationRunning())
6 ?1 Q. {2 y% R% g WScript.Echo("Simulation is running!"); 2 r0 U1 H9 }$ i9 I! T
' {. N/ w4 ?& H$ V
// Wait until simulation is finished 6 V$ r/ W; P9 _
while (!Finished) WScript.Sleep(2000);
' V& w2 p# q. x1 Z" D ; C- q- X0 ?/ R* ^) R7 W- S5 U
simple.CloseModel();
" w6 R3 K5 F. r" Y; c, `simple.Quit();
1 x6 z8 ~8 p) `) P2 ^( K: i: YWScript.Quit(); ( U4 H$ J3 p E, j
( |. k6 a5 C* o; q. ^# Y
' ~& w* E, L2 j/ M- Y X Mfunction RemoteControl_SimulationFinished() & \& m: o& b7 F) D& P% p
{
t3 Y0 O+ C! _3 D4 l4 a WScript.Echo("Simulation Finished!"); |