Example of a JScript
0 c0 }# u$ B( q, M1 u- jvar vbOKCancel = 1;
$ c3 o3 s- o) r6 i5 }var vbCancel = 2; . D1 U8 a+ {% q3 r
var vbInformation = 64;
( U; C0 X: N6 d: c; m5 B3 i9 svar Finished=false;
1 W1 T1 Q* b" u5 a4 }% r' i& `0 h* o
3 g7 B, l9 Y+ }# Jvar WSHShell = new ActiveXObject("WScript.Shell"); ( h7 b& W- r* m8 d; C1 Y
% t, r S) r! t, U$ e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: K6 h% Q: @+ q" T/ a5 }, x( _; ]
5 |% z6 S3 T: m/ |4 @simple.SetLicenseType("Runtime"); 5 O6 h( f3 c; F: w6 s' {
5 C" O! r: C& D* t3 j" b0 A( R
try 4 i+ O% ^" x" L6 j
{ 2 v: }: u& x: V+ G5 L; J2 ^
// Enter the path to a model file! 7 u7 C; L% H/ f# S8 z
simple.LoadModel("C:\\Models\\Test.spp"); / `7 |4 @& L |* K! y! i# ]
}
7 w1 j+ g$ r, W4 k3 |catch (e) 5 K2 V9 p; @% X2 q* ?
{
6 @$ p) B* }+ p' o WScript.Echo("Could not load Model!");
4 _1 `; b4 r- a$ i2 ]" d WScript.Quit();
+ C0 B/ e( M0 ?2 H" X} ; \$ i8 @7 l( {" u; C
2 o t$ `: K' r" S+ E: gtry
* v6 t. ^; l, n& W; _5 n: [' g{ / x/ u- s4 ?4 h4 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 C3 j4 K# {; e5 w r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 [) [, Q- I$ \ l
if (r == vbCancel) 9 ~+ z: Y$ D, G4 t6 K; Y% _
{
9 K# F5 X' ^$ ?* q2 { simple.CloseModel(); , R5 @+ q1 F0 G3 A
WScript.Quit(); 3 n6 C: h* @' u1 U9 H
}
" r9 d* h3 f& j8 Q$ f6 F% a}
1 c. j+ ?& V& S0 R! }, U; T
: i) Q, z! I/ r; K" R4 ~& msimple.StartSimulation(".Models.Frame.EventController"); * d" N3 z/ z: Z8 j* o
. @( t! ]: P! ^9 ^5 q, {6 g/ D
if (simple.IsSimulationRunning()) * y6 O* `7 X! B. d; C2 Y" Z
WScript.Echo("Simulation is running!");
8 y4 ?) i$ L5 u
0 y: r _6 w, v7 \! T// Wait until simulation is finished
# C$ q5 w; ^1 u$ v1 M ~& qwhile (!Finished) WScript.Sleep(2000);
6 w' I/ z$ B* z" Q
! _; G+ j% a! s3 Q" Q0 J+ r3 q* usimple.CloseModel(); 2 B; v+ r0 N; X3 [. x
simple.Quit();
) H* o) k9 \9 h; Y2 yWScript.Quit();
4 U; r7 C) Y4 J4 {" _
1 M1 c* a. R8 S0 G: {7 w. L; K
+ r' e$ F- g! A; [function RemoteControl_SimulationFinished()
8 |$ G. H7 h$ D, Q7 x H' [# h' Q{ + h2 D+ t4 k& W( U- Y) t
WScript.Echo("Simulation Finished!"); |