Example of a JScript
" F% M$ e h2 a0 ^( yvar vbOKCancel = 1; & M6 r* G$ d4 J
var vbCancel = 2; 6 `1 H7 M* X/ V+ {0 Y1 |
var vbInformation = 64;
9 x f# J4 \0 M1 a( _' v; jvar Finished=false;
5 w& S8 ^) u6 a$ I3 ` # M; G+ n5 y$ d3 e$ Z
var WSHShell = new ActiveXObject("WScript.Shell"); " o2 K7 Q; r1 n' X4 L6 }
& f: v* ]* G# H( ?) _var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 N/ y0 ]- R0 C6 D8 d
_/ M3 [0 h1 s4 o/ R- w8 s! Dsimple.SetLicenseType("Runtime"); - P3 G" g2 r$ U: ]7 W2 m
2 R- u2 o0 j7 h$ F9 S( k8 z
try 3 ]% A3 Z/ `& K- b+ d
{ ! N9 r: T" ]$ G& v5 w: d
// Enter the path to a model file! 5 m+ p2 W% C1 s$ v8 _
simple.LoadModel("C:\\Models\\Test.spp"); " |1 V# s; m( V: }9 i- N. E# ]
} ; ^$ _* n+ } X2 E( F
catch (e)
# v+ i. a' @* N$ C, ]/ r$ _{
* g; W4 k5 t% \ WScript.Echo("Could not load Model!");
$ `4 b+ N, t; U% e8 L WScript.Quit();
; I1 X3 h" g9 _} ; P+ e3 {, ]' C: t, J& z ^
" _7 m) _. Z6 _ H
try 7 M6 G9 n$ [5 U: L$ s& Y, {- K3 x
{ ; ~2 O5 l' k- _ @3 p1 u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# Z) n- G3 O0 A5 v$ P3 S- ^1 M3 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; H* {; n" Z/ Y8 F
if (r == vbCancel)
3 S( w0 o1 @3 u' z( i v {
* h& S" c& J5 m1 `: T. z simple.CloseModel();
/ ?2 P& s6 D% ]: {" G. f, K WScript.Quit();
# i j1 S v% b }
5 @. M( l9 q/ J6 s5 w& n} # I& V4 @: K9 p$ `
( i' k) E- f- ~- j' Asimple.StartSimulation(".Models.Frame.EventController");
4 t" w' h/ s3 l' c1 @7 N4 k
0 _: h) T9 H( _. h/ |if (simple.IsSimulationRunning())
# D5 g- }; Z4 T; h6 v" y WScript.Echo("Simulation is running!"); ! U: X7 {4 n" C4 \( u
$ E; D# g! H; y- G// Wait until simulation is finished * ^2 C, `) C; q! J
while (!Finished) WScript.Sleep(2000); ; h( d) x* a* p
$ p( P9 t' A. p) V* q( R
simple.CloseModel();
. f& d( d# b9 B6 x! ]: Fsimple.Quit(); . {; A5 y- E& e/ \$ V
WScript.Quit(); ; n9 w: a9 i. @! v
. `' g3 f s1 m; s7 e- v
6 d4 J1 L [% ]6 n l& ufunction RemoteControl_SimulationFinished() ' Q; o) x* c- C& t3 |; W# L% K
{
2 @6 f3 R! e V/ A$ H3 o2 | WScript.Echo("Simulation Finished!"); |