Example of a JScript
7 r N( V- S6 p" } e8 \$ \! tvar vbOKCancel = 1; # l/ s1 v* {( t: x9 \% H0 x
var vbCancel = 2; # m6 F. B. r F
var vbInformation = 64; / O/ h9 b9 \ k4 J6 }
var Finished=false;
4 _3 c! h, E, c" C5 ?5 ~
8 Z1 B+ b+ O: }) F8 jvar WSHShell = new ActiveXObject("WScript.Shell");
% p6 r! B0 |; a. J% K " k! @* a% y' T* w$ R3 a
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& D- u9 z0 F% J$ I9 N) X
0 Q; q; P+ D4 l: [/ T6 bsimple.SetLicenseType("Runtime");
6 U+ Q' [, e* B, j0 J* T5 ^ ( a. C+ u3 G2 a; `: i: _
try
2 W# k$ @" i, \" A: V& |{
/ h: d" U2 K: I // Enter the path to a model file! 1 s" j/ K2 J8 l/ A- A. j, L
simple.LoadModel("C:\\Models\\Test.spp");
/ A3 o: f6 \4 {$ s4 |} # I# d5 _7 f9 T- S
catch (e)
q' V1 C! B: z T+ m{
$ e! ?8 m% I3 D0 e# P WScript.Echo("Could not load Model!");
; k* h8 j: R7 j) \' ^7 ^$ t6 w WScript.Quit(); 0 g6 P9 j( S4 U+ T5 g4 e: z) A: E
} $ e8 h; ]# Z+ I5 r4 i1 n* K" `$ c
1 r* N9 b" p" z/ r4 U+ g
try 5 B! H2 ]8 s' l; E4 p3 s
{
8 [3 n! m7 @ t6 ~' O simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " s: m0 X' @% }9 s7 {5 Y; r4 P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' d @- @) V0 o6 m0 b! P% ~
if (r == vbCancel)
( [$ Y h. _! Y; q! p { 3 }! a! y% H- A- {% [1 u2 i2 C q
simple.CloseModel();
& ]- X+ C* Q- Y/ I: g( X: U WScript.Quit();
. `$ |5 \' @- B5 s: D8 t; r }
6 X) X- F9 F# x} : ~. a2 y# V& ]' ~6 X
' Y. e8 G/ M4 g5 q& Ysimple.StartSimulation(".Models.Frame.EventController");
& i- a" D4 C7 ^5 o( f [! M1 T
8 l: p- y8 S4 I- T$ e# q9 f& ]if (simple.IsSimulationRunning()) 9 K) o7 Y, I8 q! a
WScript.Echo("Simulation is running!");
. I6 ?! P- `; n6 B5 e* f$ W& v$ q7 y * ?# {/ e1 P" {, n& x. D
// Wait until simulation is finished
$ N* ]+ M/ c- c+ b' x, nwhile (!Finished) WScript.Sleep(2000);
/ q5 q+ q1 K% M( ^ `1 Q 2 |" D3 [( d& Y0 l: s
simple.CloseModel(); 4 W7 i) {1 y( t3 z0 P; q5 a: L; ?
simple.Quit();
. e5 M- j6 j3 x2 [ ]WScript.Quit(); 9 H. M: J2 [* V
" X6 M3 q! p; }9 r4 @" |0 X
% |7 A3 _3 Y5 M0 W! y! E( {5 i9 c
function RemoteControl_SimulationFinished() 8 x3 d5 S0 w7 ^- D* |( Y
{ 5 z! L$ b6 F n; G1 ^* `/ ?* @
WScript.Echo("Simulation Finished!"); |