Example of a JScript
/ ~) _, K) W% c* Z9 mvar vbOKCancel = 1;
8 N4 h/ X5 U! |, D) ` jvar vbCancel = 2; ( c* a4 i% P+ t/ ]7 P: X
var vbInformation = 64;
) R+ b" I" {) `2 Cvar Finished=false;
' T5 |8 A# I1 F- g/ g 8 N+ J! X! Z0 Q4 B' K5 X& l6 ]3 m l
var WSHShell = new ActiveXObject("WScript.Shell");
1 E% K+ t; e! Z( R% D, u. Q) n! m
+ z. X# ]0 B" n7 m: g* pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# l- K1 J1 O/ e9 L* `7 R i' H - U9 ^/ F& \. `4 Q
simple.SetLicenseType("Runtime"); 8 `' W6 W% a. Q
0 [& E% j# d, L
try
6 m" T# `1 `1 F V* t) T{
) A& l9 x _2 X // Enter the path to a model file!
) k; `7 H9 e- j simple.LoadModel("C:\\Models\\Test.spp");
# q4 ~5 o; R* j3 E8 a, H9 \} 5 G! O: U# d% ]& A/ Y
catch (e) ! c7 s) I! T4 w; T; k5 i
{ ; k- ?+ T7 ]9 o# m1 B+ j
WScript.Echo("Could not load Model!"); : }: G; Y$ h' i4 W% ]
WScript.Quit();
, \& H7 b: D' X* p( {1 T* B( j}
- o& S ^; S. W% u/ w. H+ U ; }, Q4 {) R0 k) u& r5 G3 o
try
! F& ^0 Q7 F+ x( {9 [6 j{ " @0 ~+ E" r/ n2 Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 r$ _; o3 B+ I Z0 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) m$ }( }7 X1 I if (r == vbCancel) % H7 I) O( x) z
{
( Z" z5 {# b0 S& _; j' l simple.CloseModel(); ' S# k$ A0 c1 o [6 M
WScript.Quit();
0 O+ i1 A+ b: u' \3 k }
, M9 k# t, G, ]) N x}
& q! j/ o3 E2 r
, S+ J3 y0 Q; W1 w6 psimple.StartSimulation(".Models.Frame.EventController"); * x% q! ?# f. _9 u* y: A
: N$ J9 K/ }2 Q- n1 K2 K1 nif (simple.IsSimulationRunning()) 8 f2 e7 s2 g2 ]. A) ~% M
WScript.Echo("Simulation is running!"); 2 }% q- L- B; y& o/ j
% G1 T" s. W. v9 n9 ~: ]+ t// Wait until simulation is finished 4 ~" ~0 \( d: F
while (!Finished) WScript.Sleep(2000); 6 a" S+ M1 F$ t8 n
5 V: C" ]! }3 O& k6 I7 d+ U- u
simple.CloseModel(); ) i2 L9 x6 L; f) U8 |
simple.Quit(); + [: f+ m1 @2 R& E
WScript.Quit(); , N3 R7 @3 e: v' Y+ G9 o' M7 R5 U
. }- F/ O3 A+ L( I e6 b
* [. v% L5 y" y2 X( l$ y! F' ^# @function RemoteControl_SimulationFinished()
; y8 `' P7 x C" {: B3 }( _, v; s) o{
/ ~/ x' A7 ~' [6 [9 F WScript.Echo("Simulation Finished!"); |