Example of a JScript
; @3 u5 J1 A F; b" I% M- |9 tvar vbOKCancel = 1;
0 G3 b; n, Q! K/ lvar vbCancel = 2; 2 ?9 O% I2 S. m9 K% X
var vbInformation = 64; & j1 y3 e# b( }2 @$ }% v; L
var Finished=false;
' m7 I% _- \( l; F1 g& y1 H% `
3 x4 l7 N. Q6 _2 A5 m* T8 Rvar WSHShell = new ActiveXObject("WScript.Shell");
" g# Q+ }/ N3 Z0 t. w+ {
l- d3 u9 q# V" U/ {& M3 W5 nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 L9 Y" L: u/ y5 P
; O' J9 b" r& c4 A$ Z
simple.SetLicenseType("Runtime");
$ |! C6 ^7 w& b K- F 8 |' J- X' }. }5 p4 f0 Q
try
4 O; S2 c0 Y* U6 w3 g0 W( V{
8 _ |& M( A# u$ k: E9 T1 m! K- \ // Enter the path to a model file!
# m4 g% n* J( H- E3 V3 ^ simple.LoadModel("C:\\Models\\Test.spp"); 7 R% {! X9 R* }$ H
} 3 H, m! g( p+ ?6 ]! d* S, z
catch (e)
0 O' M5 j1 H# [{ : D/ y) J( R( d- M" [/ C, w. f
WScript.Echo("Could not load Model!"); 4 q: }/ f; f7 w& j* K4 Q5 L) \
WScript.Quit(); 7 \% r' m& v% e7 Z( e2 d# ^* w8 A
}
" U+ ^( W& M q, \
V; M* W4 ^4 A- A9 }& F8 `& O! ~& ltry ! p$ w$ F2 C- j0 P D! ~5 ?4 g
{
% p5 i" p: |! S" V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : E+ D: B& B' l; E4 k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ u8 @% B& X+ r; e5 d% c% ? if (r == vbCancel)
$ S/ l( o8 Q9 B) Y. f {
+ Q7 F/ I3 n3 m- r simple.CloseModel();
# w) {; ]+ x. f9 ^7 j3 j ] WScript.Quit(); ! O: _7 ~ Q$ ]
}
5 X' w4 U, z7 |2 j/ t; i: B}
' P H' \% d3 y. Q
) I& Q* H% N, G5 ?$ q7 |$ M( osimple.StartSimulation(".Models.Frame.EventController"); ) \. G) O$ v, J. `/ E
1 `. b9 e* w, H" `3 J& S: jif (simple.IsSimulationRunning()) 7 p: V1 ?+ { m7 ?/ Y6 N# J. m
WScript.Echo("Simulation is running!"); # B5 E; m% D: g! t( d
7 U5 A: d/ x8 v6 D5 t; l& d
// Wait until simulation is finished
# K7 t" n# w, s; T' R- z2 ]while (!Finished) WScript.Sleep(2000); ' D+ D( d7 T# @/ ]/ Q
; w! U+ {% I& [! I. ]/ e
simple.CloseModel();
4 h; f9 T; t4 t( n7 ?% l$ Jsimple.Quit();
7 z, \$ m. U: ]) ^WScript.Quit();
2 ~' x1 u l& k/ z" P
: u b5 p2 T& ]3 q: X1 f7 q9 S2 o: `" c
& z! h: d9 R' m6 |6 J kfunction RemoteControl_SimulationFinished()
t4 k, T4 C; E, p* t2 d3 [, M{ 7 v# i5 {0 y0 V7 `) U
WScript.Echo("Simulation Finished!"); |