Example of a JScript
$ |/ Z* p; J# b8 A3 N D- Kvar vbOKCancel = 1;
# X; Z" H4 r& G% l6 A6 q E' `. ovar vbCancel = 2; 9 R$ F, Y/ l# v
var vbInformation = 64;
& v( x" `! B$ ~) u. T+ yvar Finished=false;
7 q1 y' m, k5 f! @1 B ! e" Z, a$ i1 T8 u
var WSHShell = new ActiveXObject("WScript.Shell");
8 K2 C. e- p3 o" H9 M$ A y / ?) ?3 V" t5 o& R n$ f7 m: ?, z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) h) D9 P9 J% I6 U
, O0 K4 \2 t9 w+ c3 ^+ Dsimple.SetLicenseType("Runtime"); ' d) u$ m9 c0 F _
4 n9 x1 s% O7 i+ Mtry
, g6 N0 a/ \( d) V3 |{
, m2 U6 B6 }1 ?5 |3 A; D // Enter the path to a model file!
2 e3 o- u/ I) y) @ simple.LoadModel("C:\\Models\\Test.spp"); 7 u) \/ \7 `" @" B
}
8 Q! u6 r \! K S) I Y, d9 E* acatch (e) , L' u/ T' _4 Z& ^
{
4 z. |: S- P. ^" s5 e V j WScript.Echo("Could not load Model!");
- A- d& f; q. p6 [) W0 f) q. v6 g, T WScript.Quit(); 8 t% A9 _7 u3 C" _0 c. y, S
}
5 s8 ?4 g. f. ]4 H2 p2 x0 x6 s# E) w: m
4 y" N3 @: w* ]8 Ytry
3 B) B/ b5 z! Y4 A6 d{
. X5 `( I# l7 s* _; t- y0 { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ d4 l3 Y; A3 S% U* c$ u i' N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ A3 I9 h% `+ m$ x+ B
if (r == vbCancel) 2 L, K5 L" J) i. x# s& U
{ 6 B' J3 n; _; |) K5 p3 o, S
simple.CloseModel(); , v7 U& j. x2 K, j+ x
WScript.Quit(); 9 d: L/ x0 X+ ~0 M! B! O/ R
}
& h( W& o; I7 j( A1 C8 c5 K, k} $ L1 e: t/ X, c9 r0 l) K
- `# @8 N# e# f+ b3 _4 n: [3 V
simple.StartSimulation(".Models.Frame.EventController");
9 O* t( P* U0 B/ S9 {
9 m4 a. n/ V Vif (simple.IsSimulationRunning())
4 c' o9 c d5 O. G4 {, e* i* E WScript.Echo("Simulation is running!"); ) {% j# ? x$ V5 @, h: |
4 H, E' G/ y, w- d2 P// Wait until simulation is finished % S0 Q- _) H0 H
while (!Finished) WScript.Sleep(2000); 0 t) b7 b! N2 j- M
m' B3 ?4 H% ^
simple.CloseModel(); ) k3 b( x5 U4 N/ |6 n2 f/ c' } o
simple.Quit();
8 i. D: P3 j: `. b2 ]WScript.Quit();
: u" r6 A7 E- x. r6 d# d
/ b6 h' P8 ~8 T7 J
6 f7 P5 @+ r% T8 q* D, wfunction RemoteControl_SimulationFinished()
' h J+ G7 Q. ]) Z( [. x{ ( J, Y* e" J x0 m
WScript.Echo("Simulation Finished!"); |