Example of a JScript
8 M# r Q5 e* u: [2 m5 d( Dvar vbOKCancel = 1;
' m% ?+ R3 J' q& {, q5 h" wvar vbCancel = 2;
/ b3 K& _" C, S x1 |1 }, Evar vbInformation = 64; " X" G7 H8 T# _3 I# B* s% B4 `6 B# z
var Finished=false;
8 ^( P, B" P( N4 U2 p) ] 3 u: \; h5 Z2 h. Q
var WSHShell = new ActiveXObject("WScript.Shell"); 7 h1 c! j. M; n2 M. j
- l, v3 x9 m( B* R) S/ `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / Z; {) j8 @) n, Z
( E1 y, l3 [; T( D6 z9 D5 Psimple.SetLicenseType("Runtime");
F5 }( c8 t7 p 1 `; t0 y g. @ x- Q
try 7 l; S$ |$ j& u4 h$ t6 y9 H
{ / l5 ^: P J' u0 u7 m( A; K* V
// Enter the path to a model file! : ~. g! K! \- E
simple.LoadModel("C:\\Models\\Test.spp");
- h+ [3 n" F$ A# |6 h( T}
: o2 o) P* u& l* U Z! `2 G; _catch (e) 1 v% a* Y F4 C# ]' q& S
{ ) f! B5 Q) `; W
WScript.Echo("Could not load Model!"); * m+ P- \) k( x; H+ R9 ? y2 P$ V
WScript.Quit(); 3 F8 _# N, U( }9 ~. P
}
; j8 P ]2 t& v3 ~9 t4 ?
& F) M: H# x( M6 Ptry ; q2 |! H5 c9 h
{
. ^$ } K5 A' D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ q8 `2 I! ^: |: P0 V3 P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" s' ~+ z7 Y* m& _ if (r == vbCancel)
$ ]. g+ t7 q8 a% U { 2 A& o- [5 S# n& v7 o( _
simple.CloseModel(); 2 ^- T3 i7 W+ ]( |
WScript.Quit();
( ]7 p! e/ {# u* Q" O } 9 O1 M9 o, r. d8 z
} 4 S2 ]# S0 W3 q6 h- d* Z; ~
& ~+ T& `! W8 S! ^3 u' j
simple.StartSimulation(".Models.Frame.EventController");
" S2 g. Z! p; Z) D . ^ N3 H# t! _, K, U
if (simple.IsSimulationRunning()) ! c i+ x2 S. P/ I; f5 c
WScript.Echo("Simulation is running!");
6 f( E7 l+ z* e9 P$ C
; N& j/ w$ m( i" P- G// Wait until simulation is finished / v/ D8 W; y2 y
while (!Finished) WScript.Sleep(2000);
0 D1 [# {6 _2 G }$ {; ? 7 z( V7 y" [3 l7 }2 P
simple.CloseModel();
, y8 ~# \# ~5 l* b3 E6 p; Zsimple.Quit(); & O2 d- [- q1 i& T; M9 p% Z9 x
WScript.Quit();
- s- M- p2 \5 N4 i
: J. R3 U# Z7 d4 Y9 l9 H. f# j& J
& N7 [) d, @# \function RemoteControl_SimulationFinished()
9 W2 P/ H! |& O% R6 Z! G1 `{ 4 W$ A( q& Q# \9 z9 ^: r! m; `
WScript.Echo("Simulation Finished!"); |