Example of a JScript / a- t9 _' D8 G, P5 d5 f
var vbOKCancel = 1;
9 u2 h' g1 G$ U Yvar vbCancel = 2;
/ w( @* R' W' h8 l! xvar vbInformation = 64; ) E& U: y! S4 `7 y1 ~7 V7 |- l% c
var Finished=false; * s( h0 ^0 X8 @8 ~" w4 }7 Y
$ C2 e* F0 C, Q: Cvar WSHShell = new ActiveXObject("WScript.Shell");
" D7 A* k* l$ V- b7 c4 W
* t# _3 T4 e7 @9 m; Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! v k$ x5 O. s5 {! x$ h: ` 5 v: W) \- a8 Q4 J( p R
simple.SetLicenseType("Runtime");
; }+ w8 z. z6 j0 r0 W# D
, k! a3 I) b) N! Q. _5 Htry 8 P6 J4 b3 V" {- {
{
% u& l- t5 v/ r' g // Enter the path to a model file!
& o4 b, M0 f+ W) s n simple.LoadModel("C:\\Models\\Test.spp");
/ C* j7 G5 w5 W1 t5 g} 2 W% k1 ~ s' n/ _
catch (e) 8 Z6 t7 e% M' m4 A
{ 9 a" j% x+ ^ c0 A% x
WScript.Echo("Could not load Model!");
$ |2 J& v0 S" ^; b B, S WScript.Quit(); ! g) n/ N: o3 v1 E
}
8 P M6 @2 h; W& _& v5 [2 I/ a . w0 `0 S% y+ T. n% [0 U
try + L! J% C3 u$ I8 B) |4 @/ w
{
7 u3 w3 u* g$ w# g5 ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # q6 n7 `, z8 D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! ?! K! ^. T. l$ d/ ~8 v2 O if (r == vbCancel) " l* J9 i- h* X8 Z' c" {# h6 |9 j
{ 7 m( ?+ `7 A0 T1 h4 ]( C* h" Q+ g
simple.CloseModel();
2 g2 q* Y2 m4 n, F. l2 W0 ]! J- Q WScript.Quit();
8 A% ?$ ~# N3 q( ?: X }
* M5 f. H9 | Y G- i S/ M3 a7 l} & i1 X6 O, A# R+ i' Y" `
# M. ]$ s+ N5 K* S+ A ssimple.StartSimulation(".Models.Frame.EventController");
# D$ b+ x8 S7 i0 X, R, c2 O
S) I- V2 j- n$ \" |if (simple.IsSimulationRunning())
- H7 H" g0 i/ N0 q9 u WScript.Echo("Simulation is running!"); . c& w: u5 ?8 T9 g. P2 k
0 y5 \8 ?6 [ \5 H% t7 }
// Wait until simulation is finished A( J% [( a0 } E1 Q. S
while (!Finished) WScript.Sleep(2000);
8 L A6 r3 z6 |1 [1 e6 ]6 o ; k& l9 Y9 f5 c, o7 C3 X2 O: B
simple.CloseModel();
2 h& i+ y5 R) c, \# ~1 E) N( gsimple.Quit();
1 ~" f s: F9 pWScript.Quit(); ( v5 ~; g: R+ o5 B
$ v$ z, s+ t. [7 a& B
, w6 P4 `5 C, y, I3 K. wfunction RemoteControl_SimulationFinished() 4 h: m4 l" c0 V: z: F" T; [+ j
{ 1 L# v+ D; Q' K5 S) ?+ ~5 u9 c& n
WScript.Echo("Simulation Finished!"); |