Example of a JScript * b# {1 [' N( z8 h- \% m; b
var vbOKCancel = 1; 1 F1 q5 F4 U' L0 H/ ?- \1 t* x
var vbCancel = 2; " A/ L' f6 B" [) @) R5 V4 E! g
var vbInformation = 64; # ~7 ^' G: j+ N$ f% D1 h$ b
var Finished=false;
* T7 Z) c. B/ d2 `( O2 ]0 F" [
. `" \; t B# S% Evar WSHShell = new ActiveXObject("WScript.Shell"); * a$ b3 z. E' \ m
( o, t+ U8 i1 e- Q) [! K' F' V9 b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# s0 D, O8 v4 p 2 d8 }/ A% t \6 a+ m
simple.SetLicenseType("Runtime");
3 j: }. G% ?; f
4 w. O# J0 b* ^0 c; K/ ]9 utry
5 ]1 {" e$ _9 u* V{
" ?! x* K6 U9 [. S, G/ N+ T // Enter the path to a model file!
; V' p) |& `+ [0 h. l/ u3 b7 d simple.LoadModel("C:\\Models\\Test.spp");
1 ]4 p! P1 g; R}
, }' g) b% ^( vcatch (e)
% A, w, ?4 x$ `1 {5 s4 E" E& t; Q{ 9 ?% l& ]3 v, S- j1 G6 Q
WScript.Echo("Could not load Model!");
; H7 G# _ `0 B) V$ k WScript.Quit();
/ _8 G9 U- O9 x8 g b/ r; K% D9 \}
* S ^) e9 b2 ?4 o! w" c' w ) D7 T/ @% v8 l
try
2 `2 F+ ~# r& }; O: h% p. X1 c{ ' _* U3 Z M& I% v0 r1 @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 G' A: n& n7 I( }8 }8 n$ ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 t9 U! [% r; ? if (r == vbCancel)
, Z" A+ @. m+ a9 n { , Y5 H/ Y1 a9 k! Y( K8 U* D ^
simple.CloseModel();
. C- `* E* n. [% B% y WScript.Quit();
+ P$ S& ^! B2 a7 v8 W1 n0 z8 F } / N- {+ |- x. ?
}
. c4 a/ T9 }! @6 Y& ] E( Y0 H8 m$ P8 n
simple.StartSimulation(".Models.Frame.EventController");
- h9 G! ]+ Y1 j* I
# T! e) f; n) _if (simple.IsSimulationRunning())
, m1 i7 \ y0 l* v7 s WScript.Echo("Simulation is running!"); }0 F; ^: y0 H) F
5 {: |% _& ^( q9 F/ J: }; J& q/ S
// Wait until simulation is finished
O" k& M. @: g! L6 ]8 Uwhile (!Finished) WScript.Sleep(2000); 1 _* X$ ~; S3 a0 I0 ~7 x) M
( ]* n/ k: {) Q9 b* l: bsimple.CloseModel(); i9 J. b) k8 u6 S. ^. t" P1 V
simple.Quit();
, \9 H0 i/ ~3 z/ U1 BWScript.Quit(); , o! {8 b, D. F; d8 ~
- E( r+ r% `" w+ D5 q+ I! J/ T ! X) T: V* D* L& p1 w' |: p: H/ P
function RemoteControl_SimulationFinished() 0 @5 B# N; ]( j m0 A% ]+ t
{ " _' K) [! K+ B1 X# b1 B
WScript.Echo("Simulation Finished!"); |