Example of a JScript $ l t9 o4 t" D q
var vbOKCancel = 1; 1 J0 s3 a: B5 h. n' P
var vbCancel = 2; 7 {' t( M2 w# U/ E8 t3 J, E4 v1 B
var vbInformation = 64; ) y* B& p; I- C- K1 d
var Finished=false;
1 X) V1 V" i d+ { # {6 P! y# ~! j$ A; y# @& G& X
var WSHShell = new ActiveXObject("WScript.Shell"); 5 i4 m+ d% d; `& Z
: Y6 E8 ^% }( `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, l! T7 [4 L w* ?: I3 ?2 K
0 d+ V( o* I4 i% Q( L5 Tsimple.SetLicenseType("Runtime");
1 W. h+ H! \5 ~4 R8 t( n! b 4 R& {2 C" T4 e' v0 A
try / c; G7 E9 J7 g3 ~2 n# d
{
. j& n1 f4 }0 d0 r3 |) `5 `- l // Enter the path to a model file!
- X9 _& F$ G6 c& N4 L1 O2 B simple.LoadModel("C:\\Models\\Test.spp");
`8 P8 e7 S- P( H}
/ c" w- G o& }7 H. \5 bcatch (e)
n* {" t v& F5 ?{
8 }" o( @) |* m WScript.Echo("Could not load Model!");
6 b" g- ~- u! l WScript.Quit();
: I; ^8 _8 j! X! L; Z% d" V0 l1 x} ; {; U, d x/ h; f" x. d5 j# r: e; i
$ a% ^2 F+ Y4 L: \. v; A2 y3 [: y
try
. A6 t t( P* i3 z0 q0 R{
) A8 ]6 q$ e: x/ C5 Y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 V$ C7 u$ V3 C% ?% \- y5 T! Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& z0 v! x6 F/ j' U if (r == vbCancel)
6 ]: B# X* p6 H5 P* F {
+ T9 O) O: M J1 f+ r* P' a3 J* x simple.CloseModel();
?: g: c0 b I2 d WScript.Quit(); 0 `. t/ f: A3 _4 R0 e1 M( ^. H
} ) t! J, \6 M5 i0 w% v& Y" D
}
6 [! {7 w4 d& ]- q% F
- e% h" W |" Osimple.StartSimulation(".Models.Frame.EventController");
& A( h. q8 e% c 7 o! T! j# V' G9 U2 X3 v
if (simple.IsSimulationRunning()) 1 l( K+ y$ J2 q2 X m
WScript.Echo("Simulation is running!"); 3 `/ X0 f; U: M1 b7 v% R' e- h7 m
; f# A# I. D% M6 b& p8 z// Wait until simulation is finished : W. p4 o: Q6 l2 t( M7 m. w/ E8 p
while (!Finished) WScript.Sleep(2000); " l, W9 y6 ^* G0 M- Q
/ y4 t, v+ c8 A* P
simple.CloseModel(); 7 D: Y3 n8 }) u* G
simple.Quit(); ; q) D: f( p9 X! S
WScript.Quit();
# Z5 s& N- R3 q/ c 2 K( {$ C& ?5 ?# G) M; ?8 J7 O
, m4 ]" ~& p; @1 J7 |
function RemoteControl_SimulationFinished()
{2 l- a/ O( |5 J, l5 K5 h+ m{
3 O" t- Y/ X \( J WScript.Echo("Simulation Finished!"); |