Example of a JScript
% u% z& U; {3 f+ y, T8 Pvar vbOKCancel = 1; 0 N6 f, {+ f1 b. s
var vbCancel = 2; ( ~, W% I* w0 _: M
var vbInformation = 64;
* K" z( q. r1 V- |) }/ e- nvar Finished=false; # _0 x, D/ o- p9 g3 z& V: _
7 g& ^7 |2 x8 `% E- o9 vvar WSHShell = new ActiveXObject("WScript.Shell");
+ ~. q- @. T* D
$ ^) E9 b" u2 f! J7 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 P& j6 A& s2 o) }
7 D- Y z# K. K
simple.SetLicenseType("Runtime"); E: p) t6 s5 ?( R; A# w3 S
6 P4 K7 W% V( e! r9 V
try $ x+ Y9 p) ^% J* X& L6 x% z
{
- k* k: z: {1 V( K* R8 e3 Y8 H // Enter the path to a model file! ! X: v2 r3 h+ o, q, s. f2 M3 o
simple.LoadModel("C:\\Models\\Test.spp");
& B7 J& e8 |& b5 N. [}
: O8 h Z* J+ F/ Scatch (e)
) f9 L7 x J% k9 s3 W7 s{
" d# l3 f1 r6 j+ K- f0 z* @& k WScript.Echo("Could not load Model!"); 7 C n0 ?( X$ @ `/ D. ?* S3 ?' C
WScript.Quit(); - b; _0 W4 U/ f- @' z3 g3 I0 U
} $ B% p) f4 j+ t1 M( f! d
0 g% G2 B b. \) k% W' Xtry
) ]/ T. y5 P- k! h{
2 z) j& ^1 j4 Y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + l6 ^, Y0 U o$ V) ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 L/ h" Q$ G, D) \# q Y- _
if (r == vbCancel) + u& Z( R( l$ y: W) k6 X
{
! s* B& J# Q, M3 ~( W8 C* O5 M* S simple.CloseModel();
* B% P3 v& P0 r% N) Z) c* _* |" @$ G WScript.Quit(); 1 N6 F! P# A( d
} . m) |8 Q3 _1 ~% ]8 [( u4 d
} 6 T2 p5 c0 R2 `+ G H- f
! j7 v/ h+ c b Y) q6 o+ |
simple.StartSimulation(".Models.Frame.EventController"); + o& E% J7 l; G) \$ T+ i& q
, @# G0 G( A! r2 Eif (simple.IsSimulationRunning())
9 w: N( t/ t9 w3 _) N+ o! G! w" ^ WScript.Echo("Simulation is running!");
4 n6 ^( B) ?& n( C' q2 l
9 u+ R1 D$ K$ w// Wait until simulation is finished , H4 v# |$ K1 O6 K
while (!Finished) WScript.Sleep(2000); ]; Y, i; H- Q0 L @
$ O, X- t# b9 K& P- O! |7 Q* Usimple.CloseModel();
[2 Q, u+ i7 v, p5 Usimple.Quit(); ^) e2 S& n I$ s' z0 W6 I8 _6 `9 h
WScript.Quit();
/ W5 `4 P) X4 Y5 e ( `" o1 O* C7 M2 f( a% i& Y4 B
/ h* o0 J0 A D& J, b8 S2 i
function RemoteControl_SimulationFinished() ; ]% \0 x, [1 | S* v/ k- H/ V
{ ' y6 i, I2 b1 _8 |( I5 a+ f- a
WScript.Echo("Simulation Finished!"); |