Example of a JScript & G) Q' F' y/ E e
var vbOKCancel = 1; 6 q( _$ Z- x1 m/ N% j3 G1 x
var vbCancel = 2; 6 X5 u- F# k, R- j i
var vbInformation = 64; % ]( s2 u: K% B5 c# ^
var Finished=false;
9 B x5 e$ @! R l2 { V" { / g z2 p9 d+ Q S4 R+ `" ]( d
var WSHShell = new ActiveXObject("WScript.Shell");
h/ p0 {, `0 N7 _$ Z" R) c
" j* C& e) Y# o4 b8 R( u* M$ z, Uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( G( H R0 i- K / Q; W' q3 ~! Y" l) c/ Y
simple.SetLicenseType("Runtime"); 7 j+ [+ ?) o3 d4 V9 J
$ n7 m6 k% r& _, {/ U. |. K3 X( c
try & E- ], @) T4 U6 ^ @5 d
{
# q$ |9 U+ i* A+ u9 [ c0 T // Enter the path to a model file! 1 O; D; \3 i! ~/ s1 G* i2 N
simple.LoadModel("C:\\Models\\Test.spp");
# z7 ]' x$ m: n4 ~} 5 o/ G) T9 J. g
catch (e) ) l/ w5 V4 y! ]3 R& `8 P$ W
{
' U F! r& Q" _1 X; M# K O" j WScript.Echo("Could not load Model!"); % E8 Y: n: k3 E' B
WScript.Quit(); 1 X5 f* X+ }: |- w5 D
} 6 S$ S: h& n/ k9 F) [$ D0 `6 x H M
4 v4 _5 J6 y/ X& y2 M1 _5 Z
try ' e' Q2 B9 u c$ N+ J2 i
{ $ F& F# U& q3 X0 G$ C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 F' ?% b: q: g! ] U6 ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 U1 B: X+ o0 R! A/ r if (r == vbCancel) 2 R( u! {! K9 |
{ 9 ]5 t( N! l9 [6 `. K: B
simple.CloseModel();
+ n/ P* e$ |6 m [ WScript.Quit(); 6 k0 g- a9 t: {; d; V
} # _4 h$ e C3 P, [5 Q
}
; t4 g4 e) E% p" d: f# s 2 S7 p- P" {% w; ~
simple.StartSimulation(".Models.Frame.EventController");
T: S) m) G' w" h5 \, Z
- c* u$ D, V( _3 q2 g# L# x4 Mif (simple.IsSimulationRunning()) * G3 O4 l- U* ^1 @2 M1 s k: {
WScript.Echo("Simulation is running!"); / W/ |" e1 ]1 C4 E' G: C% [; a
5 Z0 D; t4 A. ]' c
// Wait until simulation is finished + A: g9 V& M2 F4 j1 B
while (!Finished) WScript.Sleep(2000);
, r8 x, X) q0 F % N; B8 i9 I: k6 a/ c- p/ h
simple.CloseModel();
; F# Y. U2 X" x6 m) P6 Hsimple.Quit(); 7 W! |3 T( P. y% R% W D8 h
WScript.Quit();
: V* i# p& r6 n' O! M/ t" ~- B
$ `4 R' [' {3 i" ^1 J `0 f ( D* b- j0 D& b9 l$ A) j
function RemoteControl_SimulationFinished()
2 d3 m3 G5 M2 p" L4 |: u. |3 L{
" O) { i" ?) Z" w9 F WScript.Echo("Simulation Finished!"); |