Example of a JScript
* t0 ]6 ?& k4 ?: ~ s1 K# e* ovar vbOKCancel = 1; ! |1 G7 ?2 E' Y- r: e
var vbCancel = 2; 6 U& e3 h+ u; l" ~& d
var vbInformation = 64;
; f) g2 {: ^/ o* G7 y$ Wvar Finished=false; v3 S4 ~/ m( _7 J" t* r
! @' |6 h, g+ q* V6 y& Q6 A
var WSHShell = new ActiveXObject("WScript.Shell"); ' C! w" K( k4 e5 N4 T2 C2 K' c
P0 ?2 h3 k0 Z. C* U# J# ~: Rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 w& N- m! i! f7 K
: p1 E. N& Y0 c& E- s" tsimple.SetLicenseType("Runtime"); : g4 t0 a) ?( I6 K+ H# D/ H; g
- k1 s) v0 j8 A3 `9 Ptry G. a) E% p! `& F( D! u9 R/ k) w( `
{ 2 W+ R+ A( _! k3 Q# ~
// Enter the path to a model file!
# w& Z$ n' S7 n# s& f simple.LoadModel("C:\\Models\\Test.spp");
, Y9 V) a/ m% n1 I) E; {& [" v} ; [3 m& h# T* @: ]: Y3 r
catch (e)
- w" F) k0 i, s{
- x7 [: w1 j4 t. {8 A5 L WScript.Echo("Could not load Model!");
9 H# C6 g$ N3 Z; S$ C WScript.Quit();
) Q2 n% O4 B* b& J1 R5 S}
/ S9 I- j8 a+ u) v* v1 q% B 5 a. c$ Y! f/ a1 }3 E/ r: n9 w: e
try " `0 O5 V: i/ m: k5 w
{ 0 u% M7 H( M, R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 T, j* p E% }5 ^5 |. O/ `4 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & k2 e7 P. E7 q$ p; V! T1 y
if (r == vbCancel) ; F8 ?6 `" C4 E2 s3 h4 h
{ . E: ^- U7 e# P6 X. A. U5 F- f
simple.CloseModel();
! I) I$ y |% e9 X WScript.Quit(); # [) U+ L: v" h' l3 x" Z
}
1 y" U3 J* P$ k: C} * h) R7 b2 P) ]0 l- b
( }8 l) r/ D+ p+ z/ r: U
simple.StartSimulation(".Models.Frame.EventController"); ' C$ _ j- r1 f0 P
4 w+ K" G+ _& dif (simple.IsSimulationRunning())
8 Y+ x% h* G7 i q1 ^# C2 i WScript.Echo("Simulation is running!");
8 }# H9 u7 b5 S9 ^
# Z- R8 \9 V' Q- X7 W' b- k) F: ], {7 H! L$ D// Wait until simulation is finished , W8 a, N9 F/ T6 F
while (!Finished) WScript.Sleep(2000);
8 @* e" a# v: T( u
! z# d7 X9 }! L4 J9 Y7 D# dsimple.CloseModel(); 5 |9 H7 r$ b3 x$ @% N) V
simple.Quit();
3 b2 z" y, w5 S1 `& ZWScript.Quit();
9 p" g2 h2 z, Z, E. x; D
: u8 U' R! `. a0 n5 v
4 i' R+ h; u [* {3 Xfunction RemoteControl_SimulationFinished()
+ V ^% c& m/ n# l9 A{
6 z2 V" [0 c% S3 P WScript.Echo("Simulation Finished!"); |