Example of a JScript ( u/ j8 E4 H- d; ?6 p8 ]$ ]
var vbOKCancel = 1;
9 u! R! u8 B$ Bvar vbCancel = 2; 7 L& ^. I" t' Q5 `$ S6 H
var vbInformation = 64; ! h/ e. A% Z* Y# I" D- t$ o
var Finished=false;
) V. \% g2 r5 O4 E+ Q
( U2 K) I2 N ^var WSHShell = new ActiveXObject("WScript.Shell"); : u0 O% j& i- Y* O1 P% }9 i
& k! ]5 Z+ R$ \/ w" h, A3 ~var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
P9 r1 W2 s: }' |* Q6 a
' E' N e$ K" F# a, msimple.SetLicenseType("Runtime");
4 d6 R8 }$ G5 } ) B6 M# c0 M( f% L
try # m& \( k$ p& _9 K
{
; D0 a5 N4 E! g+ ^ // Enter the path to a model file!
7 d# m4 b& Q; E3 M: J8 \ u3 A8 ~ simple.LoadModel("C:\\Models\\Test.spp"); ( d/ R0 P2 m! i1 `" z/ ?+ a
} % n) p8 K q" a
catch (e)
: `5 W5 L; n. i- y{
8 D2 i0 ^& v# X/ K WScript.Echo("Could not load Model!");
& g) l+ Y3 T( g7 M WScript.Quit();
4 u/ i/ i5 s" j$ T}
' m3 P. p9 {* X% m4 t8 [2 l, L
, x! ^1 r6 @$ \9 \. wtry ( h) n3 ~, C8 [5 h4 g+ J
{ * I) f0 H$ \" G) X$ c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* c _$ A4 g' E4 V; c5 ~0 \+ x r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " e- I4 Y) P1 ]
if (r == vbCancel) 3 j: I# W% K/ c: `2 G
{ 7 o+ b' q# p1 k2 _6 D( y! s
simple.CloseModel();
5 R5 a5 P( W& G) x! m2 f- Z Z0 ^ WScript.Quit(); 8 A. |5 M6 y- m4 s1 M- L/ ~0 c/ P
}
3 x8 K7 ^0 w: Z5 E) @. ^}
; p' y, ^0 h/ E" A: `2 L" k) E
$ K% U* B B8 Z% ~: A6 fsimple.StartSimulation(".Models.Frame.EventController");
, x2 X0 h$ w0 f, {( A& M X4 O
& V4 D% ^6 E8 H& qif (simple.IsSimulationRunning()) 3 P, y* `) L" U
WScript.Echo("Simulation is running!");
" r6 D3 n; [5 P$ I! {1 h8 i
0 Q1 n9 V4 y0 @6 n// Wait until simulation is finished
. P1 l! r2 n4 K+ ewhile (!Finished) WScript.Sleep(2000); ' o$ T6 }+ b( R. r) L7 N$ |! d8 A
/ i: e% T2 T& n- T& E+ Z
simple.CloseModel(); . X4 Z% }" L" \2 D! y; f. u# W- b
simple.Quit();
F- f, J) H# vWScript.Quit();
+ T9 h# j, p# P, [; ^/ ]/ w 2 o! f) _6 A% Q! y
# H- ]) w3 t+ {# X! |4 [
function RemoteControl_SimulationFinished() $ Z! g6 E5 u+ E( z. M; L3 {
{ 4 J) c, e+ G i2 K, m
WScript.Echo("Simulation Finished!"); |