Example of a JScript ) M) G4 v8 k7 L; Y$ u4 N
var vbOKCancel = 1; $ H8 L9 D$ ^& j& d; M, H
var vbCancel = 2; 4 L9 X- B+ I. R+ o* t
var vbInformation = 64; ) P$ @$ D6 @0 i( S K X
var Finished=false;
& O* V J) X% n: C7 ~
4 j) T& C4 Q2 E3 w7 n. Vvar WSHShell = new ActiveXObject("WScript.Shell");
2 t2 }6 Q# e2 p7 a
3 h! W7 B! ?' F- _$ J6 H7 q: l' q* Gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 M) m& {8 c h+ e1 ~' N2 }
1 v2 e1 n6 q- _7 e1 B9 Nsimple.SetLicenseType("Runtime");
1 J9 h3 B' ?. l0 x# V
# Q, _) A/ f4 d! J2 k! b9 etry 7 F* o* c* |0 K8 ?9 u5 R
{
, W7 w- u N$ s2 `0 v // Enter the path to a model file! ( X- l& _/ l5 |/ |* n
simple.LoadModel("C:\\Models\\Test.spp"); ) _4 O4 J' H# \
}
]6 Q, N5 G7 p8 n$ y! ncatch (e) , U; [) h9 f: }1 c$ J; O8 y
{
' O6 r. T- F" z WScript.Echo("Could not load Model!"); + o W* {# C& |& r/ t) V
WScript.Quit(); ! _2 i7 K6 p+ J
}
7 b5 e( {5 h. |0 x, P# a/ S% a; O7 f # ]; T7 B# [$ T
try
5 s T6 K4 S g) M. N; ^" @9 c{
; e0 i* n/ D& W1 |5 m" j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# c' y" p8 r4 Q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 [" R1 @ ], G' [ \. i4 M: E if (r == vbCancel) " \. Q4 I+ I: q& n( g _
{ & T# k$ w; p5 z2 m
simple.CloseModel();
6 [4 d- U- H4 b t7 \& Q! O" l& A: n WScript.Quit();
8 D3 a; [8 X' E1 v+ z( |+ y }
9 I; [& ^' h4 w- m6 r4 \3 k, N}
0 D0 L+ }0 R; | l6 p: X6 p
+ O6 I( v Q6 T! w' isimple.StartSimulation(".Models.Frame.EventController"); ; `& i! S& I- W: {7 @
/ s* y* Z$ k+ o1 _if (simple.IsSimulationRunning()) 5 q$ `! r1 e+ q4 V+ {
WScript.Echo("Simulation is running!");
- i3 t8 {0 m" p
* |( z7 G( i+ m, E0 {0 Z3 H// Wait until simulation is finished
( U! z- {# z9 h/ H1 @while (!Finished) WScript.Sleep(2000);
8 E( c8 K5 [1 T4 o, x& T6 X
6 X. m8 Q/ v, u2 ?) rsimple.CloseModel(); 1 e* r; H2 d* r9 l, U5 Q
simple.Quit();
& [" g0 o# ~) r' c, b7 wWScript.Quit();
- a" {: y+ z7 O' O, [6 \; V ! O- @! |# G2 N! L/ g- k
! Q" D0 {* Z* \- s; D4 w* rfunction RemoteControl_SimulationFinished()
7 ~- ?, Q9 y7 W{
! a1 V7 u/ C& ~; Q WScript.Echo("Simulation Finished!"); |