Example of a JScript
" q9 y& b( ~5 D- t# N) Qvar vbOKCancel = 1;
* U i- X6 d9 n8 Y. K% G) z8 m2 Rvar vbCancel = 2; 7 n& {$ ^- h% n2 Q4 n
var vbInformation = 64; 2 `/ J$ I- B3 s) W! B% _
var Finished=false; 9 O1 n6 R; U4 l/ V9 p1 q% D
3 n% `4 T2 g$ Cvar WSHShell = new ActiveXObject("WScript.Shell");
- C& g, q2 P/ L2 m( p 1 q" I$ L/ w0 T8 D- [ j2 O7 Z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; V# E% K* n/ [8 Q1 W1 v( L$ I
3 A9 M$ p, p, x- h8 lsimple.SetLicenseType("Runtime"); 6 j; G5 i9 @. y# S' j
1 G+ T" ~8 d0 N8 _- Jtry % X# A' E# c9 ~/ u- M7 U
{ ! |) b- o* B' a, R! c* T
// Enter the path to a model file!
7 v9 V2 H, {4 q7 @ simple.LoadModel("C:\\Models\\Test.spp");
P0 L2 r* r. W1 j! x5 W T}
! p9 E( X9 O% n0 e2 O+ ocatch (e) 9 w% c5 ~% X, `9 J: b* _% Y) R
{
/ a8 I% b. E0 X. U+ [. B WScript.Echo("Could not load Model!");
* e! @7 x6 ~+ @% l2 r9 i9 i W: o WScript.Quit();
- a5 B+ H& k% R$ T8 b0 L- h) m* V. H} " k5 c6 }# ~" T8 X
; O" | e& c0 {, ~0 g3 i' u$ Etry & R) m. D6 S" S
{ 3 J! w \8 a2 X0 p+ f+ b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, `% O3 v; |3 O9 y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# A. y1 y8 J3 @) T r q if (r == vbCancel) 7 Q0 d1 ]( p! `
{
/ ]: T% N1 F- k I, u3 A- u& O/ D$ l simple.CloseModel(); - o7 Q# E0 p& m4 c) t7 D+ W
WScript.Quit();
/ I8 [ ~* i. K } . j. |& f7 q0 { S
} & F1 ~0 G' @% H5 ]% B
8 E# L' L) N) @7 k, P8 z. Fsimple.StartSimulation(".Models.Frame.EventController");
. S9 x/ \" W3 e5 S6 D : k% O/ X+ r ]. [$ l+ F9 c
if (simple.IsSimulationRunning()) 0 d/ I5 F7 t1 |: y
WScript.Echo("Simulation is running!");
9 {1 |. A7 p- w Z* R4 F2 g
+ p7 T3 n% t: G# g, C& `, w// Wait until simulation is finished * X8 I* q$ p5 k5 X6 M( E
while (!Finished) WScript.Sleep(2000); 4 Y4 C8 p& M4 c
* x" H# U0 m% A: @/ j6 m0 k
simple.CloseModel();
0 i* I# N6 `2 X9 c% @. gsimple.Quit();
8 _9 ? w" S! jWScript.Quit();
! c0 `- T9 z2 o
% ~5 k' c# g+ c9 {, y2 Y3 Q
& _7 ~, e6 i% w6 Ofunction RemoteControl_SimulationFinished() 3 [8 N! A: P" y4 a2 C: w# F
{ - F8 {3 N* G' u5 w- v/ U$ u1 d
WScript.Echo("Simulation Finished!"); |