Example of a JScript
% s4 C1 m+ h" h: Q6 w! `7 e i- Zvar vbOKCancel = 1;
* `$ j8 W: d) Y2 ?var vbCancel = 2; - s6 k$ {; c4 j# D. i8 I: j( x
var vbInformation = 64;
' j/ J+ z/ v3 }8 ?8 Q, Ovar Finished=false;
9 {0 ], w; E5 m: H$ ?" k& H + a: j* U3 y* u' R
var WSHShell = new ActiveXObject("WScript.Shell"); & n" y2 p; [2 A$ W' J1 j
! W( D+ ]- N; m4 y. d; x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 y* b2 r1 m ~$ e! T2 E( r
) x+ r5 W$ ]% Y% S& z
simple.SetLicenseType("Runtime"); + G5 y! h% [% I; t6 ?
' l. J# c- v- m# U+ g# s3 R
try
7 g: F4 J0 M$ S. t{ 3 p3 a B5 E" K
// Enter the path to a model file!
! X# o! ]: D7 _* q3 Q3 Q simple.LoadModel("C:\\Models\\Test.spp");
: F& e/ |' S/ R: l( X% ^. w6 I+ u}
2 x$ U! X! |/ m; B2 L3 F9 Ucatch (e) " b" O6 t1 P8 |
{ - M. c# z7 i" z0 D
WScript.Echo("Could not load Model!");
" Y' P3 f5 E, \) {% C7 _" V WScript.Quit(); ) R2 I9 A* i- B& R
} 5 {& V# H; ?4 d% d5 v
9 M* x7 x- O% Y- g8 _( f' ?
try ' o2 R4 V9 _' n9 y* ^8 C7 z" H
{
/ N+ v1 F1 i8 c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' l) _; Y' V) r- c9 }8 G" k& A! O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" u. \, ^; \/ P% J9 C( R0 r if (r == vbCancel)
( I% M0 a" k3 x/ ] { 7 t5 S% g. ?( {; G8 i, `7 f
simple.CloseModel(); + `8 R+ N6 {2 I1 r3 \ D" X
WScript.Quit(); ! m, ^4 U0 p3 V$ r2 Z
} ; v0 I# O% [4 Z4 v- m% c* O
}
: p* H/ Y( v6 g1 C) o% x * u: o# l- I# h+ j3 x* W/ H
simple.StartSimulation(".Models.Frame.EventController"); 2 [$ `2 J. r6 V: J4 e+ J, G
$ ]! \& j# e- U1 u) H7 I. l
if (simple.IsSimulationRunning()) 9 j; m7 U- Q+ {% `5 R
WScript.Echo("Simulation is running!"); ' b6 [' {- y0 n2 h, `- t; G+ Q
9 K7 U7 }( ?8 L3 K// Wait until simulation is finished
. [- I/ ]5 E# K' \: c8 Kwhile (!Finished) WScript.Sleep(2000); 1 }* c# V* T; s: {
* x2 y; h. I: f- Q2 G7 O
simple.CloseModel();
* I& q" z" v: o' m# d5 t8 Qsimple.Quit();
% w6 S) [, p# H1 o& ~WScript.Quit(); 0 ~% A0 G% k' p0 O2 N" F
: P6 p9 m1 H3 ]
8 ?2 L" ~1 }4 e. Ffunction RemoteControl_SimulationFinished() 2 o M/ }- Q* H
{ . r- K# z2 i3 `' Q! R* ?
WScript.Echo("Simulation Finished!"); |