Example of a JScript
$ r6 C. a* W* ?$ Rvar vbOKCancel = 1; % d H0 t: t$ u1 z3 v
var vbCancel = 2; 9 e& {" q3 s2 ~
var vbInformation = 64; . P" S! n: i$ G% F0 U. j* r. {
var Finished=false;
- J$ C$ Y9 d+ s, d
$ \9 ?9 T5 W4 {! |var WSHShell = new ActiveXObject("WScript.Shell"); / Q/ h& ~5 w! V+ N& F& o4 B3 D* e3 _
: m( K# q6 r7 a( Z, V, Yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! ~- J h+ J6 [. k( @5 T. U5 ^
1 z1 U2 J: B: F {( R6 I; J, nsimple.SetLicenseType("Runtime"); + H- Q b: Z Y/ T e2 C% k
; \, I2 P' l. F0 ?/ w1 ^% w
try
* B; ~( X) R) [/ X ^5 [8 O{
7 F$ L) c! |; O! }7 O* f% d$ C // Enter the path to a model file! Y1 t$ i2 s' O, O |
simple.LoadModel("C:\\Models\\Test.spp");
# ] E6 T7 v2 B9 _% G' q/ P9 R} - q b! j& w. k g
catch (e) 6 G$ c! z5 d7 M$ H+ v/ A/ P
{
8 X0 [ z; z$ \' g) }4 Z% X WScript.Echo("Could not load Model!"); 3 n- l3 i0 @0 E9 [) z
WScript.Quit(); % l0 C' I; g. g) h2 p; t8 O t0 \
} + |" E" K0 q) h. A
& e% q' l4 F$ o$ M
try 9 K' t8 Z& v& i
{
4 u! [& Q0 S s& e5 n. \ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 `# b* q# B3 I% i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ j8 i' M7 V/ G9 ^4 B: O/ C2 | if (r == vbCancel) & j. a }/ _0 B0 j- K
{
) Z! v" K- I: {& ?& s simple.CloseModel(); , a5 f. s# F# q0 n' `
WScript.Quit(); # H( R1 J4 g/ ^) B" ^+ r
} * C4 e7 [4 a% c) \5 h& o, q2 x; m
}
2 p5 u4 ^; A, w- g' j# s9 p C3 ~; }. ]" j# x
simple.StartSimulation(".Models.Frame.EventController"); 6 x7 U$ Y1 M+ t% Y7 H# e9 t
f! }6 w4 C f
if (simple.IsSimulationRunning()) % Z5 J9 N5 [) w* T( u
WScript.Echo("Simulation is running!");
% Y! m/ [( F6 A% n. c5 m$ O0 k 3 Q1 B# D l% }) R: t/ c! r
// Wait until simulation is finished 5 k. }: ?7 K# @' z ~- G+ w
while (!Finished) WScript.Sleep(2000);
5 U- u# R' i) C5 g: `
; `) S9 s& \! z4 g2 ~- D% E& ysimple.CloseModel(); 2 `/ @4 N7 K' V( a. F; u1 T+ e
simple.Quit();
6 [/ D- g: o N% C- V! e5 SWScript.Quit();
" k' q9 F0 V/ }7 S
) H( ^/ e* ~. ^8 }# l! W L7 l2 v# p& ]
function RemoteControl_SimulationFinished() ) U3 N9 L- D s) Z1 a, Q2 E
{ . J2 C& m7 Q+ G/ [6 P* ?
WScript.Echo("Simulation Finished!"); |