Example of a JScript ( u* E: n- W4 }7 ^# L5 t
var vbOKCancel = 1;
# O9 Q; f; @ [+ B" n4 C* y* cvar vbCancel = 2;
! F4 L5 V% p; q/ f; hvar vbInformation = 64; $ q0 j& H7 t; k% `! L* t5 |# r
var Finished=false; / K5 I; a8 q- I. n2 \) f
- F" t% o* i) t
var WSHShell = new ActiveXObject("WScript.Shell"); ( O+ q9 x: ` u0 v3 r$ E) R3 V
5 J! \5 n1 y1 g3 ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 a- X! k* f/ y* w3 d; m2 A4 j- D# n5 S
; o' I/ O- M1 m) O7 F+ r
simple.SetLicenseType("Runtime"); 6 w& T2 F& K/ G0 E. a' J/ s# k/ q
( e" M2 V4 N5 p4 y/ o3 p. R
try
5 O. X9 A6 e7 G+ s( l{ % r$ l5 {' a G7 S9 K$ B
// Enter the path to a model file!
- @2 y! L; e: ]% s simple.LoadModel("C:\\Models\\Test.spp");
; C, a$ u4 e* G: O7 ~ i% H}
2 K, r) K" W- c1 X4 {" F& lcatch (e) : B: D8 p- ]) X' `+ f' i
{ - T/ ^$ Y/ k6 X! P* |
WScript.Echo("Could not load Model!");
4 z) g+ h% j! p2 A/ h WScript.Quit();
3 }9 {2 t& \5 i/ E& W}
) m0 ^3 B1 J0 o ; `+ U8 [. z4 C8 S- a W
try
! h. |: ?5 c' B8 [( k: f' n{ 0 z" H: c: g; h8 a
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# `) o6 {# i+ K) a- H- I! {( M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" A6 V: u- p+ N" Z) g2 V& x3 S if (r == vbCancel) + z8 D; ~1 W0 ]. r- a1 P9 ?
{ 9 \" G% Z4 D) ~4 P
simple.CloseModel(); ; X- E v' }; _& w# ?) l; p* }
WScript.Quit(); 1 O# }0 ^ V0 Z, B4 V
}
) C; b, ?; d- Z}
( N( A& G0 f4 _+ }& y- s, Z9 s
9 N, p8 w1 n# o& o; Ksimple.StartSimulation(".Models.Frame.EventController"); 3 i* H# w8 d. z+ K/ }# S
. j6 c! w6 A b2 j/ p- {if (simple.IsSimulationRunning())
2 n6 x1 H8 w3 o# m WScript.Echo("Simulation is running!"); 9 p0 p; U5 ^; m4 R N3 G' L
& w) X1 L' c& B6 A% \2 N- A// Wait until simulation is finished
- S1 x4 Q$ B9 ?7 z8 s1 Twhile (!Finished) WScript.Sleep(2000); # n3 `, T; e: d) c( o
+ c4 }: }+ I$ U6 J0 p
simple.CloseModel(); 0 k1 G$ Y* T4 j" j
simple.Quit();
7 m# G' e5 b* q$ t; rWScript.Quit();
% o$ n( k8 x9 v 4 c2 `) U. f6 O
3 P" w% q, s+ {5 \4 d: ]function RemoteControl_SimulationFinished()
( j* T1 {7 c9 N- \! N{
! X3 _/ \$ V# ]* Z% B, T2 ~ WScript.Echo("Simulation Finished!"); |