Example of a JScript
" X$ g6 X8 L0 p: F+ a, Tvar vbOKCancel = 1;
, J7 O. j: m5 F) Z7 k7 Evar vbCancel = 2;
8 z/ A' I$ ~/ ]; _var vbInformation = 64;
9 e# Q+ u$ R# i: t( k) ovar Finished=false; ( W# b( Z, o6 h& _6 O# g: [, W* d. U
$ f8 P- C" S. @( m1 Mvar WSHShell = new ActiveXObject("WScript.Shell");
* v: N0 a+ ~+ l+ E, T
5 d" |4 u3 s* _: e0 [var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # a0 ~0 C3 T! y8 ]: f9 D" v2 ]/ H
. P. z, c( p& S, ]
simple.SetLicenseType("Runtime");
6 g* s4 U* N/ \
; c- V4 D' s# I* J3 Ttry / ]5 y. S: a3 v+ W9 o
{
; C, F$ z& v% u5 T# _ // Enter the path to a model file!
; ^* Z( W) M' G- g simple.LoadModel("C:\\Models\\Test.spp");
# d; ^7 ^0 k8 f. u' W}
+ L) W4 F8 ?, b) Q; a3 {, L! lcatch (e)
# u' A3 ?( `* E7 E/ ]7 h9 m{
* r/ o% p% W" ?$ l2 r j- Z" f WScript.Echo("Could not load Model!"); 0 p: \ T# x/ G3 m: Q4 v: g' _% F( i
WScript.Quit(); 4 J" @7 [1 y/ m/ O
} 8 h" L7 @. v% E( c% S9 g
; u8 M2 g7 g- D, h5 X7 Ztry 8 f& Q3 s# u2 g3 c/ W5 L
{ $ t3 x- K- @- M1 M
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 y; L) a) S8 M- \) I3 W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 D. y3 w0 W6 G2 ]- N- B2 K" r
if (r == vbCancel)
3 f. e% _& E, _# } { 9 k- A0 x8 V! p* ~& F( A
simple.CloseModel();
6 n' f9 Q$ f! q8 S WScript.Quit(); 8 T: I: `/ i, Q$ k& e, R+ R
}
) k6 @* E* a+ A} ! f7 U' t7 j `6 s" d1 h2 k2 {9 K8 A
$ c) W& {9 t& O# |! b8 R; bsimple.StartSimulation(".Models.Frame.EventController"); , w! L+ x* `4 n0 ~$ M& h d+ {4 K
* @" ~% G; X9 _2 U# K; o( s
if (simple.IsSimulationRunning()) 4 ]5 G- y5 F$ `4 E- @
WScript.Echo("Simulation is running!");
8 h- @- l3 u$ e3 } y v
( I: o/ r- W& f, N// Wait until simulation is finished
5 t6 j) O8 R% ^8 g) hwhile (!Finished) WScript.Sleep(2000);
5 `2 { l- h* w! t8 X7 l* ?, Q) o 6 @8 P! z! D* x
simple.CloseModel(); 9 R/ @8 f4 b0 u3 o2 u
simple.Quit(); # {! `! K9 r- [' K# p& T
WScript.Quit(); $ g8 U* I4 |: n% V
! b) F; J7 h6 i$ G9 K
0 V8 J) _/ l3 l ~# W# afunction RemoteControl_SimulationFinished() 7 v( p8 T: E8 L$ y. a( U$ w
{ n; i5 T l# d% O7 w
WScript.Echo("Simulation Finished!"); |