Example of a JScript
, N. ]0 Y4 \4 P0 K C* dvar vbOKCancel = 1; 7 j% W" c' O. w, e/ i2 n6 z/ z
var vbCancel = 2;
r$ X! F ]# n: Q7 ] e5 Rvar vbInformation = 64; ; d- T0 v0 U% b L$ R1 M, k6 }
var Finished=false; ( Z" J1 I6 a- y1 S/ E. i& \, Z* |
, H! f5 w8 b0 l. N+ M
var WSHShell = new ActiveXObject("WScript.Shell"); " k/ m5 G8 o4 f( P
0 W$ I2 n* I5 l9 k
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / Z2 P! b, ~; ^1 L
+ C, W1 T# \7 V3 t5 |) W. Tsimple.SetLicenseType("Runtime");
5 P( q3 J1 T" h7 j! k * R2 D* a _2 \+ I" I
try & L7 b7 h5 P4 }9 y p* W b
{ ) P- H* R2 M9 q2 [4 Q4 i* R8 R/ P
// Enter the path to a model file!
6 }* i! N' N4 R3 R# `- g, u, ` E simple.LoadModel("C:\\Models\\Test.spp"); 0 k9 ]5 z- e: ]" ]. f8 u. r
}
8 P8 ^! E3 h r! Z1 [catch (e) / n G% S, _9 }* n9 N) d. ?& m+ F0 t2 S
{
% R2 Q8 a# x* s7 @" a WScript.Echo("Could not load Model!"); 8 R& L4 y+ M7 M! F; X0 _! P
WScript.Quit();
4 `+ a: j+ l4 W/ ]% F} # C$ c, y" A2 C6 j8 L
; D" f0 p: O$ I# U
try ; E( s/ i4 l% A8 [, I3 Y
{
5 S% ~1 e# B' w/ E simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* L6 `3 [) [/ ^- |1 X+ H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 V D% G' a5 ~% s. O! \) @
if (r == vbCancel)
& z* C5 h6 g' [! y! \! L8 U {
' F* |: X+ C& |. z simple.CloseModel();
: b/ _) `. D% L' e$ B$ K- ` WScript.Quit(); 9 T) D, a2 F$ ~
}
( [) Q( I8 w: z& |8 f} ) ]6 N- f8 M, j8 y9 C9 `
6 s* v1 a9 o3 K" u: x9 Nsimple.StartSimulation(".Models.Frame.EventController"); 8 A+ d$ N# _$ S5 d- a/ N" z0 V
% X! ~0 l6 ]% o
if (simple.IsSimulationRunning()) : Z2 R" N) c" [, J
WScript.Echo("Simulation is running!");
7 G( z3 }+ F* j# C I' K' f / K# ~2 n( N1 P
// Wait until simulation is finished
9 X3 @9 ~! S B p: z0 Q+ Zwhile (!Finished) WScript.Sleep(2000); F8 B6 F9 ]$ I( D' q' g3 s
, |/ [! t- f2 p8 l% t
simple.CloseModel(); + G f6 B+ c& y
simple.Quit(); 7 L! E& ]- H B& J! g: y
WScript.Quit(); % t' y' B/ t: {; Q: [
9 r& }5 D. N$ O; N# `* R
. A6 B+ o1 h) T* x5 |function RemoteControl_SimulationFinished()
2 {2 U1 Y! R" Q$ F{ 2 G) j8 O' n3 s$ E. A3 B
WScript.Echo("Simulation Finished!"); |