Example of a JScript
5 ]/ E7 ~- A4 }5 jvar vbOKCancel = 1; 5 Z/ w$ o4 ^1 s& m9 }, F
var vbCancel = 2;
2 W/ H3 n3 s1 g; n) tvar vbInformation = 64;
* D" d% j. |+ f% Z2 Q" I# ^var Finished=false; 2 J# m# F# h/ N+ g4 ^: e9 e
$ s |6 G% K& e" Wvar WSHShell = new ActiveXObject("WScript.Shell"); ! U2 d' E" i* ~$ g0 m' _3 {( y, l2 P( c
3 B2 l9 u( A/ L# I/ f8 w$ m
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 g3 m8 l, A- m6 q9 B& z7 D6 g. X
+ ?$ P& `' a) ]6 _( hsimple.SetLicenseType("Runtime");
+ O& ^ y/ w' m+ X & O# m4 ?/ z' k2 ~) ^
try ( R5 \5 p) ?- N* m/ X
{ 3 M! e" X+ y1 J) g8 _+ ?
// Enter the path to a model file!
& G- j0 F# X* `1 E- ^, C simple.LoadModel("C:\\Models\\Test.spp"); ) d% [9 w& Z5 L- v S
}
: ^2 S( L2 A7 |catch (e)
$ C, L" s0 c! O+ G4 T7 S* _{
. ], |8 B* L& p2 p0 ?, N WScript.Echo("Could not load Model!"); 1 @9 ?, C' w4 H6 f2 X9 q4 u
WScript.Quit();
0 `# \* Q) @+ b; w' M}
' }' _4 e% J* W* W% `8 A3 ] x 3 N; z- i A+ E- F, V7 n) `
try
: j) r" o: F5 l& ?{ ; l0 k3 ?/ A6 Q0 S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: |7 h* L# n% j6 x% t r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& Y+ a& k6 p+ y* I( n( Q if (r == vbCancel)
& f& U ~3 v! \ { 1 e, g- t$ P0 d/ N4 v
simple.CloseModel(); 2 L8 B5 t, F$ h7 |: H7 }
WScript.Quit();
! J) V% `. t( T }
) S0 ^$ g. n! [( p}
- u) o$ h. N8 B/ b- x- ]3 }/ V $ \4 i# R$ l! m v) ^" J
simple.StartSimulation(".Models.Frame.EventController");
2 ?: j5 b; T0 I5 |. m ~
9 ^0 Z R. F6 T9 v A" \if (simple.IsSimulationRunning()) 4 b v" o6 M6 h) {% B7 V$ b& Z) q% G
WScript.Echo("Simulation is running!");
& M6 F* ~5 m* K7 X1 S" L) P3 h
& }8 D0 \, ^+ ~// Wait until simulation is finished
5 }- E7 `8 F- E- L- ~. cwhile (!Finished) WScript.Sleep(2000); , [1 k/ \0 c9 h' t
6 A, d& ^3 ~5 A
simple.CloseModel(); 2 ~5 y! _# b: i; n5 U
simple.Quit();
7 B3 y2 Y3 C$ V; }/ KWScript.Quit();
! q4 t3 F# G6 ^- _$ D, I % G* Z* {9 x$ A3 [( c6 j( \
2 S3 l" \. R K7 Afunction RemoteControl_SimulationFinished() ( z4 Y M m+ J. s4 T, U
{
# ]; G# x2 P' r WScript.Echo("Simulation Finished!"); |