Example of a JScript * s8 w. U' s8 K, o/ U: G6 s8 T
var vbOKCancel = 1; % k# K( {/ D, H+ [8 Z
var vbCancel = 2;
% D; B/ `. u, J) gvar vbInformation = 64; , E+ t- r x4 N4 N/ U9 n- O
var Finished=false;
) h: s; Q( D9 H9 i 5 u9 v) V) i2 l+ L* J+ }) p/ P
var WSHShell = new ActiveXObject("WScript.Shell"); 8 \ I) z, f/ K6 G. E
G4 v5 n) Z1 C+ } x8 b9 @. xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 w, p* M4 g9 T* d
( M, m8 R# u$ J* t% u6 X
simple.SetLicenseType("Runtime"); 5 d6 c/ G4 q. B6 J! y
8 H9 a1 ~% T4 U: v3 s# }3 M
try
% X, `( x& { N' V. Q/ E$ y7 Q{
' s+ l1 i. E# W6 H" S: f4 b // Enter the path to a model file! 9 a6 |7 W2 q1 j; X
simple.LoadModel("C:\\Models\\Test.spp"); 3 @2 W/ ~' A4 l* }
}
- y# ]8 F( e7 D* h! T' {catch (e) 8 ~- t) Z7 `/ _$ D) |/ B
{ z6 a; r* Y$ e# J3 `9 f4 S
WScript.Echo("Could not load Model!"); ( U% W% @" M7 d3 V( ?) z3 O
WScript.Quit();
* L/ e( R' A/ E+ ]} 8 ?* f% d J. L* K2 J, j
Z1 Q5 v0 n, s. U. G% }6 S
try - Z4 e. T* V8 T$ z
{
+ \8 k$ Y* S' s( I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 C6 H! L. l. A9 W+ ?6 X% }- p5 ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ H) Z. R# A3 M; `4 j if (r == vbCancel)
: ?7 s1 ?5 |9 Q, N5 G, f7 l { , m/ I1 d3 _9 y
simple.CloseModel();
2 `3 @) x% t; A3 U( P" [+ [ WScript.Quit();
& R% S0 n% p6 a- E7 g' s } $ o: s( [! u8 V, W1 n6 J
}
6 ~/ h+ G) _- T* w- S+ z; W
& H' ]5 A- |2 F, O) g- u: ], P# y, isimple.StartSimulation(".Models.Frame.EventController"); , s8 I& |# w8 z
+ ]% \ C+ u, @: _if (simple.IsSimulationRunning()) ( q2 G( X" a' @. y1 Z9 A* U
WScript.Echo("Simulation is running!"); 7 f `' p8 Q9 X
[* b. [/ H9 n( o: v6 S4 Z4 V
// Wait until simulation is finished * [* `1 u9 n4 V/ j: C
while (!Finished) WScript.Sleep(2000); 4 D B" w- G1 Z
/ [; F/ M8 T" n; s! u- T+ X
simple.CloseModel();
* \0 a4 l1 \6 A/ Rsimple.Quit(); 0 E( G. e. y3 b" l7 x" y
WScript.Quit(); : b. k: O: {7 M9 m4 O' N& T4 E; h
+ p/ n! E* m2 R0 r" Q( P # e6 o8 |/ p+ h0 I
function RemoteControl_SimulationFinished()
3 }4 ~% p; V# z* t" z{ 4 y8 j4 h, s9 F
WScript.Echo("Simulation Finished!"); |