Example of a JScript ) x$ t& r0 x, y- X
var vbOKCancel = 1; 0 ?4 b6 L2 U& N. J7 Q1 e# j" y
var vbCancel = 2;
E/ E H# E# B; A. J: Q9 \var vbInformation = 64; : x5 T4 D- G! [ U/ h$ v; l
var Finished=false; / ?' `" `3 h3 q& w# Z
0 E# o+ Z- g/ X& b: M' V% T9 m. J
var WSHShell = new ActiveXObject("WScript.Shell"); # u: f% s3 Y6 ^5 e
9 `5 c! A/ A% t! \" @+ ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) [. {0 b8 E+ J' z& z: ]8 |
, o1 h3 Q# X3 o9 Q- @4 nsimple.SetLicenseType("Runtime");
2 D5 g/ F9 T$ {& H , ]$ A) y X; ]& k4 p
try / L% S0 m4 G5 n3 U, p9 @' j! B& Y
{ 0 F+ n' f/ V1 R t$ N( ]
// Enter the path to a model file! 3 j# E3 b+ z* c( c6 G
simple.LoadModel("C:\\Models\\Test.spp");
0 ]& M" R5 e' ~/ b& H( t} $ m( }6 `- e+ T0 h6 i& `/ O! b$ {
catch (e)
* Z. _- v c0 W0 n! U/ J{ % Q" z6 m, _. u% z* K; ?
WScript.Echo("Could not load Model!"); 1 ], p/ L8 U/ y' {- D
WScript.Quit(); 6 P+ i1 n' O' S7 a
}
5 A. G, g e! n. _0 S* k : M% Q2 g/ ^+ l! G
try % o: s2 h0 Z' F; w& f& _+ p
{
! s' ?! Y6 O+ ~3 s7 X4 Y h* E" ]% V5 M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 @# x* C( a1 B4 d' q& D r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 |5 M( T+ n( L* G4 [8 G5 P
if (r == vbCancel)
/ P! z) G4 ~7 b7 F { : j& w+ ^. [( ?. c6 M
simple.CloseModel();
0 l D8 U' @0 D5 h7 M0 O. o2 d1 ~3 ] WScript.Quit(); ; J) b- t* M9 \ V c
} # h' u! G" e9 n! B& S0 s1 |" b4 o
} 4 s- ?; U# d! m) t' @
! P& z" @- h- Y' c; z+ y5 A! j
simple.StartSimulation(".Models.Frame.EventController"); ( [5 a- r1 j" z# k8 {4 X
6 q. @' |$ V; c8 l6 W; ?6 q4 kif (simple.IsSimulationRunning()) 3 P& {# @% G( E; e6 r/ f, H9 ]
WScript.Echo("Simulation is running!");
0 D% ]4 v( M& i3 V. N2 t
_4 V8 N* Z& p# x; E; z+ R8 _// Wait until simulation is finished
) S0 a% W+ I% J5 U; f2 Ywhile (!Finished) WScript.Sleep(2000);
+ r K8 P$ A0 m + X$ P \# U+ r' `. O
simple.CloseModel();
9 Y! i, Q1 H* v+ K7 b- esimple.Quit();
* ~, n& \. L& ]) P$ W- X" RWScript.Quit(); " T2 R* \" j4 E' \9 H: E1 d0 \
3 r7 U5 B& `! H
; C# r+ @, I$ e3 G2 o5 |% x( Mfunction RemoteControl_SimulationFinished()
1 G3 Y% n+ }* |8 x5 ~& U0 k{ ( U1 [7 F. B1 |* S
WScript.Echo("Simulation Finished!"); |