Example of a JScript ; Q* v0 ]7 m. A9 M; _& S
var vbOKCancel = 1; ; L& h8 `% R$ w, l
var vbCancel = 2;
: Y% O3 h z! J' N3 gvar vbInformation = 64;
+ F6 y: h( }' w* Y. @var Finished=false; 0 _' d: p9 O% d8 k2 h/ b
+ Q9 l8 t' w* [# D8 z% F- ]
var WSHShell = new ActiveXObject("WScript.Shell");
* _7 f5 H: {. O* v+ I% Y6 q 7 P' g. {1 |9 z1 \. W P2 n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 }9 a! V5 ?: J; Q& t 7 j* }, e! p% X4 ]: ^
simple.SetLicenseType("Runtime"); ; k! B( Q9 @9 e# r7 k% f
6 g! {7 p. f2 E) k4 l* u" P
try 9 j T% v8 ?+ O& H5 E! a
{ $ W x5 s; ]# A3 b9 a' V0 L
// Enter the path to a model file! 3 Z5 y% L" z5 X
simple.LoadModel("C:\\Models\\Test.spp"); 3 K6 w5 h1 L7 I# ~
} 8 m. |7 Q2 A- `- t$ Z, o# B8 l
catch (e)
2 n" R, q- L0 e$ m" r9 O{
) }. k) K2 h$ e' k& Y& R WScript.Echo("Could not load Model!");
# R1 Y( O6 H* q. u% B6 }& t0 r9 D0 m WScript.Quit();
+ S7 f+ ]9 B7 j* i6 |}
, p8 x3 {( z2 {% {# [: Y. ? * {; S5 s5 x# m, c5 L' p, u. D
try
' h) P4 Z% q! `- Z{ / E7 q# I& k" Y6 g7 t8 \/ m" e
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 \% \8 }1 \$ \# Y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : D' u0 A7 s" x2 ^% ~2 M! L
if (r == vbCancel)
3 E. m5 Q* ^/ g" g% j2 K { ! n3 U/ a* B) J" Z7 D( Z
simple.CloseModel(); 3 c/ i+ D8 ]) O7 ^% `
WScript.Quit(); - D; `3 K0 K. d
}
+ o; g. @ F( n0 f: G' v}
f* h& W- Y" s/ C( l. P8 Y
% B t0 _5 A* X5 z! ~simple.StartSimulation(".Models.Frame.EventController");
3 r% L. k+ M% _# d
9 @1 ?) {2 n; i N- `if (simple.IsSimulationRunning()) $ G) a% F: s* i, b/ r- [# @
WScript.Echo("Simulation is running!");
: V8 H6 D' Z3 x) U6 B" K8 |& d 2 d& [ {4 L% ~$ F# a2 }
// Wait until simulation is finished
# b) n: b) y% k8 w/ Z6 A" C- l2 Nwhile (!Finished) WScript.Sleep(2000);
* r/ ~' @- X: |9 K 7 q; o+ U3 r! G+ H0 R
simple.CloseModel(); ' I m: g2 d3 {$ I+ T9 S
simple.Quit();
; D) b z" _6 K& _& ?* iWScript.Quit(); ; c$ R$ P+ p l' b2 K; d
, C6 _$ i. S) I% b. g; M2 Z
; D: X- p4 R3 P# [" F
function RemoteControl_SimulationFinished()
) q8 C* }( J: d' `/ H. f{ % \2 X. D: g ~+ c9 K# G# L4 U
WScript.Echo("Simulation Finished!"); |