Example of a JScript ( W8 \* [: I; O2 ~3 e
var vbOKCancel = 1; # }- @- K0 w% |; e8 Y% w
var vbCancel = 2; : S! @1 ] ~. m/ ?
var vbInformation = 64;
$ |5 N, B. E6 gvar Finished=false;
' t5 J2 E8 B3 _$ x, `5 s% J & e' ^! G. R8 H$ l: \- d
var WSHShell = new ActiveXObject("WScript.Shell");
; _+ S. t ?4 _3 U$ a
% P# `- V% y8 D; K- Bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 j' S! r: c3 y$ Y# E. E$ l* G
( ^) ^" v9 S0 T) {- E! w) n
simple.SetLicenseType("Runtime");
0 [9 ~/ [( _# Z& z% L . v* j/ P* j0 G5 X& B* O
try / f) i+ t% M$ S" h' i
{
, C& ]$ a( V8 T7 k. }5 n+ G j // Enter the path to a model file! # @; Z0 c9 ?& m, C6 X
simple.LoadModel("C:\\Models\\Test.spp"); ; ]" v% g9 L4 t: ~
}
( J" @/ n( F/ ]9 Ocatch (e) # m0 p( W6 k6 R3 c# N
{
* ~5 {; U: y- ]/ E$ p% L' R; b WScript.Echo("Could not load Model!"); w: a' R ?4 ^$ G, Z7 q1 L; b
WScript.Quit(); " E0 y$ S2 L, S, Q- _8 t; w; X
} 0 u7 p# b* P O2 r
' s. u9 N& B" q- l5 Z6 a$ }/ rtry ) K F8 J3 R- `. u+ i- c3 [
{
: |6 d2 g) G6 U, q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 Q3 x& M1 h8 r& K# ~ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 ~$ B$ |! L3 l6 d2 E$ s! X8 Q; M if (r == vbCancel)
4 P* t) k: V: q9 D { - z/ O( b6 Q+ P0 [/ f4 z$ w
simple.CloseModel();
5 e2 N: L" x( B( @ WScript.Quit(); - q0 G' p7 A1 `+ ?. o# h' t( q: g4 `
}
6 |& `% J9 _/ U. n N7 \/ a} % ]' ?. F6 t4 ?7 Q% a p
/ Q$ v. V7 e1 l
simple.StartSimulation(".Models.Frame.EventController"); 8 `9 g/ Y/ s3 I0 Z- R9 `. J
# q0 y; k* X, ?) ^if (simple.IsSimulationRunning()) , W+ l6 @2 \3 p$ m7 P7 S$ ~
WScript.Echo("Simulation is running!");
: @4 \5 y6 ?$ ~
I% ~0 V8 p0 K, u// Wait until simulation is finished
: U' r N7 s; Gwhile (!Finished) WScript.Sleep(2000);
' Q" N' O4 \ }5 J : \$ X) M. ?" {* X/ r
simple.CloseModel();
* L2 s: ]& ^1 |4 osimple.Quit();
) A0 G& k0 G. h$ @' \WScript.Quit(); ( R+ ], e$ ]8 V H9 y& g- }/ y
6 X& `- ? c$ `# U1 T/ z, M
8 q8 x2 [* D, Z }4 f3 Mfunction RemoteControl_SimulationFinished()
8 {! [6 X' y- v; V& |{
O6 s2 x9 E1 I; {6 T% w- S WScript.Echo("Simulation Finished!"); |