Example of a JScript
$ g2 A* X0 e4 \# |8 f; ?var vbOKCancel = 1; " a E* u I- E3 ?3 b/ V/ c
var vbCancel = 2;
) l- u: U4 T8 ~7 v1 x! K1 uvar vbInformation = 64;
* z3 `, U+ D4 p6 Lvar Finished=false;
; F% Z/ t: H. X% ]7 i) Q
' b. n+ b9 }% T4 nvar WSHShell = new ActiveXObject("WScript.Shell");
1 S# ~$ S* v4 w3 f5 A) U/ T; y / j! E9 _! ~, D+ g* R2 H1 ~2 p/ i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " V0 ~% w. B2 `8 I+ B+ h0 L
0 M$ t: {* c$ m! `simple.SetLicenseType("Runtime"); ( T6 [: G/ J4 \6 Y! b& b6 k! H
& B: A$ [3 C1 \8 S7 ^# A( c9 }. ltry ! P: W& q+ V2 b
{ # i* e* P5 R0 b& H; h" X5 ^8 {
// Enter the path to a model file!
4 n4 d/ Y1 ^% h$ O$ j' l. t simple.LoadModel("C:\\Models\\Test.spp"); . q F# M) g$ N( ]0 }1 E" M
} 1 Q' a! g( Y& {, `5 j: a6 A
catch (e)
0 Q! O$ Z; L9 b) R" n3 {{ , r( W. G1 L) M
WScript.Echo("Could not load Model!");
8 _5 B e$ Q0 I7 f: { WScript.Quit();
( Z5 u1 b7 a2 z. h. B+ |2 z6 M}
2 h; F# S$ W& d
( {6 {8 I N& i9 [- u7 i/ j9 Itry
/ R+ b, X9 j0 b9 m6 c{ ! T9 {$ A/ Y8 S9 U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : {4 }; p4 A, r$ |) F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * K9 Y9 ^+ B# ?" Z7 Y- o
if (r == vbCancel)
5 X, Y) M+ P/ E- y+ q) P { 6 e( { j' u* W+ H& t9 r
simple.CloseModel(); . b2 [) {$ G: b
WScript.Quit();
/ c" o( J2 F3 @) d) ]! p( } } " ]7 g7 g9 e- m
}
. w9 c- p2 a: S! @ \ + N I6 N1 w% h M, H$ Z
simple.StartSimulation(".Models.Frame.EventController");
$ i' n) {0 O- D' f# _( F8 B- R / Z& I( [& z8 g7 B& l* Y& D1 \
if (simple.IsSimulationRunning())
* n( U% D, g# O3 y# M WScript.Echo("Simulation is running!");
% P+ ] i& [6 B
1 y$ I9 N+ R& h# m5 [// Wait until simulation is finished
' l& K+ O0 A' Y+ v& Y+ mwhile (!Finished) WScript.Sleep(2000); / r- A, `; p+ @5 Y
7 ~& W2 E& L% O% N2 I/ [" F& O
simple.CloseModel(); - r" \+ W$ T% ~. D6 G' g" K
simple.Quit(); 8 f+ i9 J/ m5 A" B4 Q
WScript.Quit(); 4 R: q3 h* S, V4 C6 y9 g+ g
( s5 r9 O! S+ |
4 D' r1 w/ G. m4 D* Y
function RemoteControl_SimulationFinished() {1 U; n+ R' W& J$ i
{ 2 q. j7 k, a( t5 B2 X
WScript.Echo("Simulation Finished!"); |