Example of a JScript
7 n" i% h' @; b) Z" Avar vbOKCancel = 1; 3 ]9 i6 s$ a! c0 R) r% s( A
var vbCancel = 2; + b r3 k: y9 X2 M
var vbInformation = 64; u/ p/ I# }7 [/ R% o9 h
var Finished=false; ( J+ p3 x; o5 b8 F6 J
; i) ]9 B+ W; ?( I- ?var WSHShell = new ActiveXObject("WScript.Shell");
% y9 M# z* l1 @4 m+ E
% s2 ?' R. @6 _6 p1 Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% `& y I6 p( g+ |( S& d
9 |& p/ Q& c8 {7 K, i/ m2 dsimple.SetLicenseType("Runtime");
5 x. n, h H" _3 }" F
5 p9 {- @/ f0 z- g- m1 Btry & A- R z% P# a) z6 j
{
5 {. A9 s0 o) l4 O% Z, ? // Enter the path to a model file! / }# s/ r( B, t. g1 g+ y
simple.LoadModel("C:\\Models\\Test.spp"); ( J- @3 B7 x0 C' \" I% S% o
}
8 ~+ @: X! ]4 G2 j4 T9 Kcatch (e) - @, S1 p7 t/ `
{
0 g; E' y+ H( `5 R5 M, { WScript.Echo("Could not load Model!");
4 v7 Q. ]/ b% U' |, u% ~ WScript.Quit();
! a. d* n- l2 D2 F5 R}
; |8 Y0 Q& X( }; C0 e
/ `8 Y, I0 {$ |+ D! utry
7 n7 ~" p. C+ F$ m{
2 r3 p f# e0 M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ u: O0 L& i) j7 Z5 _/ E8 @, K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. W& K( ?7 ~8 q# B( t& F if (r == vbCancel)
4 A5 q5 w _* O! M {
! H7 S' V7 a: n) c, I( ~. J# A0 ] simple.CloseModel();
8 M& b! A3 ?$ X6 j# j8 a, m- H( F WScript.Quit(); 0 R' u: F' T$ A: ^. J6 U
}
8 m# }' V8 p0 s0 U- ~8 x9 A} " r7 ?6 N8 Y8 |0 } N2 \7 o( o
8 E6 _1 B ?8 U
simple.StartSimulation(".Models.Frame.EventController");
" ~( A, ]% j/ k, a : H8 W' D8 D- [( J9 N
if (simple.IsSimulationRunning()) 0 G }( u0 G5 X7 N5 C) X9 u3 Q$ H
WScript.Echo("Simulation is running!");
" \6 C* l, A& A! U - o& d( v& K9 t# w Y
// Wait until simulation is finished % }' i* x' c/ q6 C4 {+ U! R
while (!Finished) WScript.Sleep(2000); 4 |& X4 i/ Y1 f
+ }: G' b/ F' ?4 q6 H! esimple.CloseModel();
- F! P$ y# H( dsimple.Quit();
% M8 U/ J9 M1 S0 HWScript.Quit();
2 k1 r3 ]- N) j
# N/ H5 ~% {2 Q% y8 K5 \7 C
2 i a" g: k. y" i: ?8 Ofunction RemoteControl_SimulationFinished()
; A- W3 w8 c* W4 M{
2 H6 ~+ X) h q& H1 q J9 I WScript.Echo("Simulation Finished!"); |