Example of a JScript
- [- P5 l! m1 h1 W% D2 uvar vbOKCancel = 1;
% k5 c- g! [8 Q8 qvar vbCancel = 2;
* U9 \$ {1 q. u0 n% `# ovar vbInformation = 64;
# q" s* t8 O9 Gvar Finished=false;
P4 q, d/ ?4 _ ! [& R. p% |2 j8 a
var WSHShell = new ActiveXObject("WScript.Shell");
; @' ^1 o7 F4 E& [
) N+ s2 o1 d+ Z: }/ Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ c. G. i6 V3 x2 x8 M* ]/ _8 R; p
( k6 l5 @# U" U, U. ?simple.SetLicenseType("Runtime");
# V8 r+ r$ {4 F# o8 d5 U$ h
, Z/ e! `( `" A: U$ O' Wtry ' Z. o1 c, p7 z# G: s
{ . {, ]5 E" `5 ?( i; K: l& `/ J! W
// Enter the path to a model file! " v0 N' Y ^6 G1 w7 {1 y+ b
simple.LoadModel("C:\\Models\\Test.spp"); # U. G- {' G4 B o6 }; @) v2 ]
} 8 m6 X5 H8 ~$ a0 N
catch (e)
k$ B9 r6 C4 V2 G- d- k{ 8 P: J# u5 R0 ?# C8 ?) c( [
WScript.Echo("Could not load Model!");
@9 d( _4 h {' q# U WScript.Quit(); ( i2 q( C+ P: M b6 z8 n3 [
}
) P9 N- q0 i/ r3 \6 x' K7 K0 e % f2 F0 p% ^; }6 m. D' ]
try # f. o8 g m7 B/ E6 M: M
{
# h `' C1 S$ N z5 ^3 y0 N; V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 {8 f( R5 F9 C4 P! `& I1 q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 e5 D0 }( M1 l+ y- ^- P
if (r == vbCancel) : z* s( J' Z0 [: L
{ * g/ A1 s0 v& V6 N
simple.CloseModel();
4 |, m" l, e1 y WScript.Quit();
/ ]) S7 p! q J) k } 9 d; i, k" Y) [* \; l6 Z8 a% I
} 8 s! G0 o% L7 Q2 a9 S. [- v9 M
: _% g+ t# D: ~9 z, s# ~/ \3 W8 e
simple.StartSimulation(".Models.Frame.EventController");
% T: C4 @' F' S) }
( L( q5 t1 K, u; @if (simple.IsSimulationRunning())
: r- W1 d: e: K: {$ O: W WScript.Echo("Simulation is running!");
( z& O0 S. h0 ?6 d; t) E) \% J. \
8 N' _% x% r1 t7 R! x( I7 x, D// Wait until simulation is finished
5 D% ]/ i# r7 E4 F2 Hwhile (!Finished) WScript.Sleep(2000);
4 N0 k4 j2 b$ a3 @4 i F) l " s' \, j0 a# P6 |& Y
simple.CloseModel(); / e1 x) l$ x* a+ ]2 L
simple.Quit(); , V/ n8 I0 ~* c5 g+ p1 j
WScript.Quit();
/ U& ~- D" |4 Y
4 a) }# K% B$ W8 p1 f
/ r, M) D! \! Y4 Ifunction RemoteControl_SimulationFinished()
% a- c# I7 T( Z% A5 g* H$ \{ 1 `% ]- G% |+ f! V
WScript.Echo("Simulation Finished!"); |