Example of a JScript
% \" r2 J4 h6 e' T/ ]) m wvar vbOKCancel = 1;
1 \# s0 L8 R" x+ y& Bvar vbCancel = 2; ) ?8 q" ?3 _3 _6 Q. \$ U* u
var vbInformation = 64; 7 I( P! e. h W) X+ f
var Finished=false;
9 f# _- E. }0 d" S0 y% p! W
9 E. A, e% k& p4 x, gvar WSHShell = new ActiveXObject("WScript.Shell"); $ z5 a: o% L, g/ U" C
4 x7 x( C* `3 pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 { c. c1 O: _" p) H2 z
+ M+ @/ J# q! w& E; W* M; dsimple.SetLicenseType("Runtime");
6 X7 H [/ |* d {' s- w " Q7 J1 d- v, G, K M
try ' }0 b* B3 { C6 ^0 \/ E
{
/ o5 C$ S) J/ Q. e: t5 j0 Q$ M // Enter the path to a model file! X2 d9 _; I1 R% M; U0 f9 T) c% Y
simple.LoadModel("C:\\Models\\Test.spp"); 4 f# A) h2 W' Y! c
} 8 M- {0 m1 e$ T$ l
catch (e) ( R e. @& R! a, G
{
6 e; `! |% V% N+ r$ j" ~ WScript.Echo("Could not load Model!");
4 J+ s5 t9 s# O! Y" z5 Y: d WScript.Quit(); : n2 m `# J; H8 _6 p4 f$ Q# q
} # U! G, ?% N. K+ t, x- n
0 D) e/ R5 D4 `7 I
try $ u3 f3 G+ J% i" c
{
+ u/ f+ b* ]4 h/ o* t7 q+ d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! b' T6 m0 j- G, F' y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & T9 i) n) F" }& f
if (r == vbCancel) * D9 O) `* s4 D+ q' j, |
{ \- V6 x+ ]/ {
simple.CloseModel();
% l2 L0 ?% i# W% Q& E: r WScript.Quit();
6 ^- z. y* M$ D& W } ! S | q3 ]2 h# b/ p5 P
}
9 a8 E% K2 Z2 r! u p) u! A& d
3 m" z7 l2 ^ [$ [- M4 jsimple.StartSimulation(".Models.Frame.EventController");
& p3 x- u, ^& N& b/ F+ I+ e8 S- s : q! v/ Q3 H0 p, C
if (simple.IsSimulationRunning()) ; W. V. h8 G- U7 j
WScript.Echo("Simulation is running!"); 3 F8 b- g' R3 M) ^4 [
( \* B4 [" K$ O) e8 U6 O) n// Wait until simulation is finished " b! Q' k. a" I4 v v" ?
while (!Finished) WScript.Sleep(2000);
1 Y2 f1 U' G) `0 p' q( P: Q6 }
/ a) w9 d( T9 Ssimple.CloseModel();
* R- K" V& ^% J+ ?9 l7 Ksimple.Quit(); . X/ z1 q. T2 Y, v, n+ \7 E9 i
WScript.Quit(); / F9 e x# W% O W2 @5 n# z5 b
8 x' d, g* f2 C2 ~: Y& P
, ~' S2 Z% v$ p5 }function RemoteControl_SimulationFinished() ' _5 v# U. }& F: b E+ R+ I3 }# S
{ 9 g1 `& O" E9 ?! _. A4 W
WScript.Echo("Simulation Finished!"); |