Example of a JScript
- m: c3 c/ O) G) hvar vbOKCancel = 1;
$ ]- ~. J) h& V1 h& B; yvar vbCancel = 2; , h& m( T; a) }8 p
var vbInformation = 64;
* t; N/ [0 i% B7 Kvar Finished=false;
' |9 R- D3 A3 }3 Z 5 v4 H* l- w& [+ p
var WSHShell = new ActiveXObject("WScript.Shell"); $ p4 \0 O( ^. S
- S3 H) p4 {" C& \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! o0 U" u% t9 d% l
( {. t8 {( {7 X d% R4 D
simple.SetLicenseType("Runtime");
/ a) _9 y# o. c, P9 v
1 g/ ^* a1 L& F3 wtry
/ V& R4 r$ T' n' j( @# {% k{
+ s% X+ `5 v. A2 n // Enter the path to a model file!
) G. R+ O. X" g7 j% p simple.LoadModel("C:\\Models\\Test.spp"); $ K+ m N0 @9 Z1 B/ t: Q6 g* w$ G( U
} ' ] U* W' ~/ E) i+ s2 { l w9 b
catch (e) 1 N6 U P0 d. z t( Z$ y
{ : i* {! [2 [! _
WScript.Echo("Could not load Model!");
, s0 q% x1 N2 } WScript.Quit();
% T, a7 Y- j6 m$ a} " x9 N& l3 ]: s7 L" M3 p" A
4 P) a6 b# g: A4 n) k7 h% vtry ( p' C. s5 h. Q! P4 g J9 N
{ : X l* ^% L, Y# _7 B2 @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ n! x2 F. w9 R9 X* Y- d) Y+ D( C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- E5 L0 y4 D- _7 ^4 t, @( S if (r == vbCancel)
7 C# y6 m. r) K) a {
, m5 @& l# d" l- |# Q6 E E simple.CloseModel();
7 k0 S b. M {* y% }# } P8 } WScript.Quit();
1 m* D- ^. r& I! }$ P+ s }
1 H) X! M7 B; }; z} ) }" C/ l; p N- Q$ r9 Q
% ?, e- Y( d/ c' ^simple.StartSimulation(".Models.Frame.EventController");
0 Q5 a! M7 k P3 s: o
* F4 P: y! l( p! k( R% L9 X3 M1 fif (simple.IsSimulationRunning())
1 h. `* W, Z0 u' G7 X ] WScript.Echo("Simulation is running!"); % T0 s3 a! S0 k# X: l7 P# A4 ?
' ^' A# G' [9 W9 p/ j// Wait until simulation is finished . b' d* g2 U8 R
while (!Finished) WScript.Sleep(2000);
; i: n; o2 x0 j/ r0 ` " Q9 \! i) R2 o* {! Y9 @
simple.CloseModel();
+ E( R1 ?7 q ?5 Fsimple.Quit();
- {. L0 W) e' FWScript.Quit(); # |' b2 E2 h) `/ o9 L7 n- z
. q: u0 b; ?* S7 g8 w+ m ! P/ V2 b# L0 m6 y: o
function RemoteControl_SimulationFinished()
. _( Y8 C2 B& }( ~2 x) L{
1 U1 z% Y6 i& |2 k: d WScript.Echo("Simulation Finished!"); |