Example of a JScript
+ ]0 D: P( C- k; Jvar vbOKCancel = 1;
6 m3 V0 F L: C; ivar vbCancel = 2;
9 [8 o2 G/ L$ z! c4 X0 Kvar vbInformation = 64;
3 p6 ^% O9 ^! c. g5 W+ Fvar Finished=false; 2 T; u3 W* h i% e6 I( A; {- i
+ s5 e$ r( ^0 lvar WSHShell = new ActiveXObject("WScript.Shell");
( H# r$ c8 V; _: r
% s. H8 t. U6 q5 K7 p6 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: ~3 q. W5 C7 w- N4 m
7 |+ Q: ~( N f: V2 i% J4 G+ O) k# Ksimple.SetLicenseType("Runtime"); 8 T4 y+ M5 Q; \% L5 ^
4 C. T8 @/ C2 l& R8 Wtry
- Q& h9 Y0 d) ~/ O3 j! k% R{
" R* z. F/ S; i+ N4 ]8 P7 |, q4 s) F- R$ } // Enter the path to a model file!
' X# u* b' B) \) S0 N simple.LoadModel("C:\\Models\\Test.spp");
2 E/ C8 c" n! m3 i& Z}
! @9 O1 S: n5 W( M7 M! ?; lcatch (e)
Q7 o5 q% C: ?9 B1 Q% D& }{ / w* i" A) w8 T; y! K5 J
WScript.Echo("Could not load Model!"); - s* S% F6 m1 `3 m3 h9 \
WScript.Quit(); 2 Z c5 m+ `: P0 I6 o; q. |8 ]
}
f* K7 v4 z/ [/ v0 Z$ F6 G( c/ G
! K8 |4 X6 c, o, U* l% ?. o. M [try ; B5 B0 Y: O+ J
{
; A+ W5 a4 ]/ H) n( C# A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 i1 [, w' @" l) `: ^3 F2 f r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# t9 t& n. i! Q! a3 t if (r == vbCancel)
3 ?; s6 h& C% L) u, _ {
( C* e" i, s; e! c& d simple.CloseModel(); S3 z) z/ _6 t/ A! u& |
WScript.Quit(); , a; ]7 k0 [# O7 X
} ! C( P* i. ?0 _ N* P' a2 m+ {
} 5 r; i; a, K" [3 ~0 z
0 A& z% q$ k6 Q" K; I
simple.StartSimulation(".Models.Frame.EventController"); * h& ]) e& q/ Z* C+ R+ o/ v# G8 K- T U8 R
' Z1 q4 i/ ]: V
if (simple.IsSimulationRunning())
1 H" I/ L- a3 F% ^, U WScript.Echo("Simulation is running!"); 7 u- M' P: l9 v( ^
$ U Y+ n9 {+ X/ l! D
// Wait until simulation is finished
+ |+ H/ X2 S' {" O3 ?! L; O7 Vwhile (!Finished) WScript.Sleep(2000); 6 \& Q8 s# S! n, o5 B
2 e: c/ V9 P8 I5 b( F; M. j3 _simple.CloseModel(); |( C$ t* a& v( [: {% i
simple.Quit();
2 |/ X% f# R/ D R6 cWScript.Quit(); * \, d6 E# V" I$ Q' r
$ f# w8 o* `0 g2 \* U* p$ u/ |
) d+ J. x# [) Z8 y0 k. Hfunction RemoteControl_SimulationFinished() 4 P# w8 I0 u1 E
{ # P6 `3 V; e1 ]9 {* a3 r
WScript.Echo("Simulation Finished!"); |