Example of a JScript 7 ~5 M& ^& _; P; U( V/ I1 [
var vbOKCancel = 1; ' q5 H; I) H) o! ~
var vbCancel = 2;
* g8 ~ x. R- _/ [6 v: S8 Xvar vbInformation = 64; + c- m6 ~" ^0 e) m5 W' {( }5 u N3 b
var Finished=false; ) ~( b# T0 t; ]! ]( o8 Z
9 p U: y- E9 F2 I) Z, Q- bvar WSHShell = new ActiveXObject("WScript.Shell"); ( G5 f, f F. ]3 U& S
: Y7 l6 L( @! O7 o) W
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' l$ H; _# _& m
! U6 }- _$ t4 D: ]7 l) {' ^simple.SetLicenseType("Runtime"); 8 S9 q/ ?: [9 E8 a6 y
' I- O9 a/ P. f* E( _7 ytry
: F9 S5 N) P: A3 ^" R, i( o{ : l8 g: n8 @0 |# u. y9 i: @
// Enter the path to a model file!
, y4 s+ Y9 k# L) K, B8 ~0 | simple.LoadModel("C:\\Models\\Test.spp"); " X; I: T; @( D5 x7 S: I- u$ e
} : R3 x m2 ^/ t
catch (e)
1 x+ a1 R: v% ?{ ! n$ @6 Z6 f3 s4 @
WScript.Echo("Could not load Model!");
: e$ z) f# H4 ?' j& | WScript.Quit();
0 I8 ] f4 Y% E% x2 h: F} " f* t- }; }4 y- [: I
% ^$ o" K& A2 f6 a. \try
; A1 d: ~2 D2 \5 G+ L% t0 A, X, t; L{
5 E; a9 ~! V3 ~9 P- [4 T, @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 o) {- k! y6 n) o# R4 f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ G& l; I! y0 _- ?# X+ `4 K0 X if (r == vbCancel) F. K- o* L+ }& M9 U b
{
z- Q/ F9 m u) ~ simple.CloseModel(); / N' h7 K0 D# D2 K" g, n
WScript.Quit();
1 f) ~1 }! q7 }! Y' f. R6 K6 L* T$ m } * R" I `! a" f+ U* R/ E5 o8 ~
} 9 E7 K1 ~' B% W8 j
9 h) m7 I0 L8 R I2 t% y9 P4 Usimple.StartSimulation(".Models.Frame.EventController"); - a# G+ S; a; I- a+ e O: U
' k- A n: y$ T, L. g5 y* @* K
if (simple.IsSimulationRunning()) % W% N. v3 L# M$ s/ w) h
WScript.Echo("Simulation is running!"); ' C k5 P% R/ h4 z( o
" W' H. [8 {. \. y! L
// Wait until simulation is finished & ]. H; |9 C6 V) d, _* J+ G
while (!Finished) WScript.Sleep(2000); 3 o/ a5 u Y$ M, X9 D
% W$ L. E. ^2 y7 O) fsimple.CloseModel();
, u6 U( ?" s+ r, ^simple.Quit();
4 U9 w& N" c, P4 i: G% {$ M) n/ uWScript.Quit(); ) r6 r, |! o1 Q {" M& H$ p4 M
4 K1 K; \! ]; o( d, P! p+ I" Z5 ]
' L+ I3 g+ s9 `* ?( H$ w/ Y7 I5 U
function RemoteControl_SimulationFinished() 9 Z5 }. p2 ]- X& e, }8 }& m( u
{ 1 L: V" i: ?2 p+ [* |
WScript.Echo("Simulation Finished!"); |