Example of a JScript
+ ~5 p1 R+ C$ g. Wvar vbOKCancel = 1;
" h4 n4 t) |$ \var vbCancel = 2; 7 T" d" L- H( o# t0 t
var vbInformation = 64;
/ l& z" R" h( |8 Z: }( J& r% Q4 Pvar Finished=false;
( R- i% Z& _" e4 e! V- H+ L $ m8 } s$ R$ ]9 g4 z! e
var WSHShell = new ActiveXObject("WScript.Shell"); . T/ O+ l( x6 O' S( M
V$ B( Y) G4 l6 i8 y6 ?, {: V
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; N" M3 V$ r, y& Z) }
! n0 y k- v D {. Z' xsimple.SetLicenseType("Runtime");
2 d: q( w; [4 N+ v' l- ?1 b
% ~+ \/ @) p$ Q/ r- R2 @0 [try
! d$ `" f' P+ Q; c% K4 k" `{ 1 i8 C- v9 c% _: m3 W% R
// Enter the path to a model file!
, G. T8 B( ?8 Q" [" U' i simple.LoadModel("C:\\Models\\Test.spp"); 0 Y" T2 V( [5 S( V6 L0 C9 {
}
2 @2 s% o$ L5 H5 G! x0 a0 vcatch (e)
/ w8 l8 T9 l, N0 s& h5 j, k! n{
7 O- g/ ^- k, D0 Z WScript.Echo("Could not load Model!");
# B# j" _, r) E- X. U' i; e& \- i* ] WScript.Quit(); ! O7 |* F7 K: l( ] y
}
6 @. e" x6 U, F+ q c
# n, S! N2 b# j8 F0 otry ! c E0 U- l3 b ^
{
% Z$ m4 \6 X M- G4 ` simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 u/ X: i8 y8 {, G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 ^( G! U! r8 _5 f1 e8 F if (r == vbCancel)
/ J% z+ J6 z1 Q( E' T8 ^) i { ; n4 f! `6 e# u# x" h) b
simple.CloseModel();
, H4 s2 q$ c1 f3 V9 c WScript.Quit();
3 w- M9 M% V0 A/ E: w0 ?) R: ~ } 2 G9 u3 k* _! d! T0 `) T
}
$ Y' r4 l8 i2 r1 y# G: v. b- B
, v! H" r( X1 b; c: gsimple.StartSimulation(".Models.Frame.EventController"); J1 f) h7 U' a& J; E
$ \7 W6 V" }: i. G/ iif (simple.IsSimulationRunning()) 4 P2 b$ \6 {* C0 I/ d) |3 N- M
WScript.Echo("Simulation is running!"); : R. q. V U( ^( c& Y/ R
" W6 e, g4 g% w9 w! D
// Wait until simulation is finished
% {2 l B8 W; A+ D# lwhile (!Finished) WScript.Sleep(2000); 7 ^: W9 Y% W9 j6 K3 w/ y1 e
0 H( ]( K7 M( u7 s: ^& C
simple.CloseModel(); ( Y& O; b# ?( V- L! f% b. ]
simple.Quit();
+ u- _* F& D6 `- y5 _" S) Q. w- z: \/ YWScript.Quit();
9 A; s4 J, J# t$ ~( V) M- S
8 v2 ?0 x6 E' L p9 m5 E & X/ i% J# w' H9 ?% H* x8 P$ M
function RemoteControl_SimulationFinished()
8 ~* \; M' E( ^( H: |{
( b! I; q) I! ^( W- y WScript.Echo("Simulation Finished!"); |