Example of a JScript . p0 p6 g B. [) i
var vbOKCancel = 1; / R6 p7 `. `" v1 }. g( h" e8 V
var vbCancel = 2;
6 M) U* I3 h- c. evar vbInformation = 64; . ^$ R1 _6 E% `: b" g; C; Z
var Finished=false;
0 ?3 a! L( W/ d1 U3 w; T ! {* P5 y5 q: P6 U
var WSHShell = new ActiveXObject("WScript.Shell"); $ A$ C8 q1 J9 N- R
3 l$ p& E! }& ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 |' k. m% x1 W& z0 B
* [" {( f( z( ~2 ]1 qsimple.SetLicenseType("Runtime"); 9 a# d7 O+ P' D
2 r, j7 g; |, b2 k
try 5 t3 s) @6 ~; x& ~1 H
{
7 N5 E) B! k4 G+ K+ [- h1 [ // Enter the path to a model file!
% f" l4 P9 l2 X% ] simple.LoadModel("C:\\Models\\Test.spp"); Y0 [3 C0 y k# d& }7 E8 u
} 2 g' n, s+ ~( u8 V/ z
catch (e)
9 I+ Q4 C& [4 j; c3 [8 ~{ f: Q' M* K8 M* \8 d+ X, |. p. L
WScript.Echo("Could not load Model!"); 4 V4 t5 k% q: L/ P# S" {
WScript.Quit();
8 F6 T/ H' Q) O8 r} " ]& d1 O0 y9 D2 S& J" p
" O$ q$ U/ s+ i, T
try % I& k5 |7 P8 p' ?5 t
{ 4 M' L+ R9 \) C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
@0 z* R$ Z6 y, M& {1 P: A: s, @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' U' @1 F/ h. e2 u! I4 ^* o/ p
if (r == vbCancel)
* E+ y5 t: C- ]: Z { / E8 E) y- j# t/ Z( s
simple.CloseModel(); 6 \- P8 i- K3 B6 L
WScript.Quit(); - R' u* P! K7 j% m( |0 ~; R
}
# r. i) P G0 N7 ~6 C# d( `}
2 x r1 T w9 j + t' k8 v* b1 O& ]( A& p; x' g3 F" r
simple.StartSimulation(".Models.Frame.EventController"); 6 ~3 X7 y% P) v9 E0 o7 x1 }1 s
8 i2 B5 N- Y" F: f9 S6 \
if (simple.IsSimulationRunning()) : |" P, }$ V% r0 E% D
WScript.Echo("Simulation is running!");
" a1 H! P, ~# q 3 W, }6 I0 Q7 _3 Q! `4 x1 G
// Wait until simulation is finished
7 x) M* r2 a! P4 @3 \% ?* H) Hwhile (!Finished) WScript.Sleep(2000);
0 l* p! `# P# k, ~9 E7 j7 Y % |% y2 n, s$ t8 n5 X$ H* u
simple.CloseModel();
, r: Y/ I& d. j. f/ n7 D& v% p3 W1 nsimple.Quit(); / I' q1 m% a0 l( q6 I
WScript.Quit();
6 v- x/ r1 x6 c A 4 p+ e+ ~& S7 w) c3 ~/ ^
: F% b3 k8 K& }5 j# j# s) Ifunction RemoteControl_SimulationFinished() 9 V% b: K" o# [0 W
{ 8 O4 |/ G! x# n, T; k
WScript.Echo("Simulation Finished!"); |