Example of a JScript
$ Y. E0 E( \, o2 a1 R) s/ ?var vbOKCancel = 1;
1 U2 A0 F" f9 rvar vbCancel = 2;
1 L5 H1 \+ u6 n* Xvar vbInformation = 64;
/ k6 \! r* O. P( v5 Xvar Finished=false;
1 h/ L/ O+ E% u6 i
2 i" \! W# A) p* G' ?* Kvar WSHShell = new ActiveXObject("WScript.Shell"); " w# V4 r+ f: f/ Z2 b4 D0 e
2 `* g" a5 d/ w: K8 ]- f% ?( X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- [, B# p x5 ~/ g; D
$ y: y, a& b5 p8 j) xsimple.SetLicenseType("Runtime"); " K' ^: m" E( e! [. |$ y
* }; M3 `" Z1 E |
try + Z+ V/ O. z7 c! {
{ 2 ^" w+ C+ G: n4 G: e1 g
// Enter the path to a model file!
% g/ c1 ?. k3 E# ~4 r simple.LoadModel("C:\\Models\\Test.spp");
. E! F6 ^9 A2 N* K( ?}
9 s- i3 P$ O1 |$ s( J c9 @catch (e)
T5 x ^: R! H, c3 ?$ B. I5 {8 O6 R{ 6 Y9 }# X. v4 J d
WScript.Echo("Could not load Model!");
+ c, T) A$ I& L3 l/ w$ Z WScript.Quit(); 5 V3 u" t9 s( ]# Q
} 9 M5 A* m- Z t! A
) C* A$ |4 w; ~. B0 I- f$ T
try / E' K: S, ]8 V4 d) j, ^
{
2 }* d. `+ S+ _( L+ I' z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 n) M% ^, p' U, z" Y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 H1 P) M. A( h
if (r == vbCancel) 0 O+ A7 X7 b/ W& i! a
{
8 a7 n- C5 I; n8 D simple.CloseModel();
# P; b- }. B9 ^) G WScript.Quit();
/ A0 E& Y+ Z2 k7 R& W; ]# c }
. b* N, }0 C: O5 ^" y2 _! X0 ]} / E7 ^2 a/ S8 j
! C0 [' I7 r% L8 n( \simple.StartSimulation(".Models.Frame.EventController"); ; J0 W/ r; c: y$ k6 F
2 ~8 L" y' k! E- v, W! Vif (simple.IsSimulationRunning()) ' {# H7 t; Q3 T/ d# i1 i3 |
WScript.Echo("Simulation is running!"); * w9 v, y/ _( a7 [' F
P/ n2 q4 t. M& A$ ?) {4 @5 o// Wait until simulation is finished & t' J* d& w* ]; k# d3 b \" u, I
while (!Finished) WScript.Sleep(2000); 9 |8 e6 A0 U" N2 T
' S9 [: D2 }/ _' b2 G" j
simple.CloseModel(); ( `, f) t) {/ W# v) C2 Z D" N+ o
simple.Quit();
( I) c' Q/ Q6 N$ r# s2 _* b3 rWScript.Quit(); 6 U# F8 x/ ^& I% v4 b: T
2 z6 Q1 c4 d: |/ j" c& _/ N/ Q
9 I, j3 M6 m, z1 X$ t; Afunction RemoteControl_SimulationFinished()
! `; b& U/ Q2 N6 ^{
& A* D2 r& a, j7 @: N/ t WScript.Echo("Simulation Finished!"); |