Example of a JScript - F8 i' \4 |# R ^7 ?$ _# B# y
var vbOKCancel = 1;
, t9 m: h, y* o: V! A, Ivar vbCancel = 2; ; w! X' P1 v. x$ x% Q& u9 i' z
var vbInformation = 64; $ A% L' u w1 P' L: e7 \
var Finished=false; 6 c( w1 M% k; }5 D
+ p5 [: V+ e) Q: E3 R2 _var WSHShell = new ActiveXObject("WScript.Shell");
$ _6 f+ Y' E4 k3 F/ f6 S 3 I j' i5 w: A0 w1 m+ s( {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. b: i) t U. K6 Q5 C , @/ E! Q. t* r, |. d6 J
simple.SetLicenseType("Runtime");
: K' Q3 f) _9 y! N4 i) a
- H+ ^9 r7 n8 O% \! utry
# Q3 i4 e6 v3 y- \9 z; y{ " X$ T! e% z6 Y& Q! j
// Enter the path to a model file! 1 M+ Y4 y4 V2 j6 F& Z: t$ z
simple.LoadModel("C:\\Models\\Test.spp");
2 O6 e" z9 V: ?# q3 r8 ]} 7 M. v7 N9 ]) }. I* Y: M
catch (e) ) J6 m+ R& w/ M% S/ p; O# ^$ K
{ 0 P7 P1 {; O! N+ d4 e" O" U( {
WScript.Echo("Could not load Model!");
( L+ Q" i6 ~( a+ D4 e WScript.Quit();
9 ~* s% Y2 q- E2 \* W}
3 \1 O; H& @0 l4 m8 @* s' q ! J) H! s- F( V$ |" ~0 {! s
try
u6 j5 d' h9 Q, l, `) i- ?6 a{ P0 A/ @ U6 T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& n; o2 x$ E" J q, C. X+ M; p' m& L r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & K: E3 ~( W2 L3 K; X
if (r == vbCancel)
- x7 K* t# B2 L" I {
8 V0 ~- Y9 s& ^8 E. T! y% M simple.CloseModel();
; B# ` ^- |1 [( {* f WScript.Quit();
8 M% O' O! v/ J% F- q } # y8 _4 G9 Z% S/ e; l- i
} 9 D5 Y k8 x p! g2 z% s
. q6 w5 _: L6 N, ^simple.StartSimulation(".Models.Frame.EventController");
/ O# u0 y3 ?/ D8 W5 w2 N9 B# j 7 t& i3 u# [* W/ ^ [5 c
if (simple.IsSimulationRunning()) 6 C5 E. b# s0 v1 _8 d8 l
WScript.Echo("Simulation is running!");
5 Y0 f+ V) _" R. F m * }) c$ L2 s3 _/ j; D3 y# N
// Wait until simulation is finished
) A7 ~; g$ m8 {; ` C7 Bwhile (!Finished) WScript.Sleep(2000); ; i( W9 l, I! ?
+ f+ F% [4 T7 [" \- jsimple.CloseModel();
7 k0 s) B) ]! Nsimple.Quit(); 5 ]$ i7 p( `& @
WScript.Quit(); 3 R; V4 p% z I2 S9 G9 O
9 U- S0 x2 H; U # |/ y0 v3 z- b6 G4 r8 }
function RemoteControl_SimulationFinished() C- h& Q# I' w
{ 1 d' u: v8 z1 N) ~# ~" M3 N
WScript.Echo("Simulation Finished!"); |