Example of a JScript
$ c8 w$ p5 F; b* Zvar vbOKCancel = 1; 3 }) { _9 Q9 |, T
var vbCancel = 2; 7 B/ p. H1 B, Z% T1 h
var vbInformation = 64;
3 P$ s( E& z j3 a8 [' S" ovar Finished=false; 4 z/ s4 F0 x! p) l) T
% _4 r o' O* h. J0 [ T
var WSHShell = new ActiveXObject("WScript.Shell");
7 U/ X2 @ E6 {
! e# ^9 T3 M) l* xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " ~. J; Q( N) I4 i; S( n
( j5 H6 y& Z1 a: rsimple.SetLicenseType("Runtime"); 3 \# a+ i+ j4 l+ _; W. |
n7 N" |7 ]* Q7 z( V) C
try 1 Z8 }( q" I& ?
{
5 M+ u Q- ~4 C4 E* C2 q // Enter the path to a model file! 3 K4 z& e5 e5 `: R( W
simple.LoadModel("C:\\Models\\Test.spp");
0 \: _1 }8 `4 {* Z} 2 s6 ^4 I3 q0 ] v
catch (e) 5 H& d" V! x) [5 }8 c" _+ s
{ * d' f. C# \# ?) b" a; r7 b1 r5 J
WScript.Echo("Could not load Model!");
" H# D. e7 T7 Y WScript.Quit(); 8 |0 @% l. b1 g
} 7 K5 S, R: O& E6 z
1 X1 N6 H7 E1 m- H: A
try $ f' P+ N9 [/ E: P- q# q: |
{ 0 G$ ?- R. n4 V7 e8 @; _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ U/ k7 H( d5 _$ q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 u7 k+ [* w3 [ if (r == vbCancel) - p2 l; |% x0 \+ _0 h
{ - f% r" }: u ]1 i. C& z* U
simple.CloseModel(); 0 O! V& @) U0 j' q
WScript.Quit();
9 R8 l& {+ K7 f8 x, U- |+ u& ? } & Y& Q! c0 y3 w! ]+ B+ f6 E
}
% ~: Z# U- f# c$ L. F* f: O, G2 O8 m : {& V' A" A- v+ t2 T6 m+ P2 P
simple.StartSimulation(".Models.Frame.EventController");
, c& r3 R- Y2 {. N# O5 n8 r3 n( @
7 J9 F: t3 v2 w4 w% ?, ]7 U" Hif (simple.IsSimulationRunning())
6 g9 |$ C$ q6 X" z* x WScript.Echo("Simulation is running!");
1 v! B6 Z$ ]3 a7 {% q# x1 L+ d
7 w* E- h9 `' `; P! u* L5 v7 O" R// Wait until simulation is finished
5 ?6 J5 j+ S6 h* B6 n6 Owhile (!Finished) WScript.Sleep(2000); 2 A" A* y/ s; _2 X) A8 K
/ [1 p/ q; S% ]. A. a
simple.CloseModel();
2 Y' G* A) p, |9 i% @8 ssimple.Quit();
% L. \( _; E# w8 G% B8 C# nWScript.Quit(); & K L- U8 `) i" r+ q6 x
c* {5 M2 Y; _: N/ h: V. i% j
( u6 U: a$ _/ b9 P/ Zfunction RemoteControl_SimulationFinished() r+ L7 `, w! s; b, I# F0 M
{ " A6 U" P+ L3 y, C9 O
WScript.Echo("Simulation Finished!"); |