Example of a JScript
( ]" }4 F& ~. p' m; Dvar vbOKCancel = 1;
+ T4 i% D. ?9 g3 k% t' S8 Bvar vbCancel = 2;
" [# K* C- b% h9 e5 P# o$ \$ X! L- vvar vbInformation = 64;
' w; C. l. K6 e$ q0 c( {$ pvar Finished=false;
; ? E. p& P' j2 s 6 N x% O! ^( T+ r# c# {$ [
var WSHShell = new ActiveXObject("WScript.Shell"); # f/ T; F+ n, ]/ z% b1 B: p
$ H6 O3 X2 g* E3 z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& S$ L9 A; d% m' x) E - i1 d+ [- i1 X/ l0 f6 y
simple.SetLicenseType("Runtime"); ( u2 C2 t* e9 |- K) x& c/ B4 f
B M. r9 _+ r! s" O; U
try
/ h7 U6 \# y$ d5 i5 z% ]{
7 S, }$ T* Q6 c4 Z1 ^4 s // Enter the path to a model file! 2 @7 Z. |# U- F' j! X2 y; {- z8 Q }
simple.LoadModel("C:\\Models\\Test.spp"); " {) n) M' {* Y+ t% m$ ]: A
}
9 t# \, d7 H8 G9 p; _catch (e)
- g7 `* m5 y$ A% P{
1 b, B- Z# |% S$ ~# h1 N2 c \ WScript.Echo("Could not load Model!");
$ @* ]/ r8 {' e WScript.Quit();
9 {+ J% t" r/ `}
& d/ w9 K! F3 K Y2 P
# M, N J, V* o7 [$ [try 4 v2 H( s2 L/ X
{ ! B. n0 d- l% p1 D* @4 r$ H# x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 _* o" Y1 z6 A; `- i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , ^% Y, O \' X$ r! u& A+ x
if (r == vbCancel)
0 K1 m7 o5 H# r8 E/ m6 }5 U& Y { / z6 W5 @9 g! ?$ X
simple.CloseModel(); 4 \3 e" w- U% m+ k9 R
WScript.Quit();
; y7 B$ o- P4 x0 \, q k+ m0 u }
2 I, I+ |; i0 |7 P4 d5 o2 H- z1 n} & i/ f) @3 n3 u$ e, z
9 i1 `- ~) K1 @' l9 xsimple.StartSimulation(".Models.Frame.EventController"); ) f5 [3 D6 @+ j& C* e' S# R' x
- x f- w: {4 A4 Xif (simple.IsSimulationRunning())
/ O0 \' v) F& E3 d4 ~& q- j$ v WScript.Echo("Simulation is running!"); " R& T6 T1 K: ?' A- F
7 w1 y8 e$ l3 c+ I( B
// Wait until simulation is finished
4 }8 q X! ^; iwhile (!Finished) WScript.Sleep(2000);
2 }; c6 S$ x$ k 9 u% E0 C% u3 m, e6 o* S
simple.CloseModel();
& ?/ w7 k6 k# L* k0 h! S- ?simple.Quit();
' h' m' \5 |, CWScript.Quit(); 5 }% t: Z9 @( Q3 g
8 ^) A: s0 R' D; m5 ?* y4 G, @+ c / ?- m; _/ ?4 c* {, X2 i, S: J
function RemoteControl_SimulationFinished()
$ w: S3 |5 p- V) l) a) K! x5 R0 o{ ! T5 D/ O! D; B
WScript.Echo("Simulation Finished!"); |