Example of a JScript
/ s$ g6 |) E* zvar vbOKCancel = 1; & K- V% L% {6 H, ?' a
var vbCancel = 2; * W$ r* W7 ]* a2 r$ h8 s3 k% f3 o
var vbInformation = 64; " V# s6 [* ?7 | K
var Finished=false; : p, F! p: Y8 U6 a, J: ~
1 [, `7 g i3 e4 [" m' E7 V
var WSHShell = new ActiveXObject("WScript.Shell"); & D# V( Q) a* H9 _
' y- E. p. M- x2 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, _: F. E+ i% z# c5 A; E ) c! \% D. [# C* O4 ^
simple.SetLicenseType("Runtime"); 9 y) @ R6 R1 p1 r( P; A
- Y9 g9 j4 `# W1 m6 d0 l, xtry
* |4 H. s1 K y. s. E6 d9 `7 w, v* o{ / P% X# A/ P6 X2 m2 q# h
// Enter the path to a model file! 5 q; G" B. L$ A" b! C
simple.LoadModel("C:\\Models\\Test.spp"); ' {- g" N, E+ Y& u/ z G
}
7 M5 q! x) L9 s( q* zcatch (e) & F) y5 N& ?& Y0 N2 p U
{ . o# L; C8 P$ B" s, E1 F
WScript.Echo("Could not load Model!");
; Q) M+ @$ c O" W$ [1 J7 P WScript.Quit();
! f, f5 s; J7 q! L- b/ O1 b} 5 A0 Z7 y: K" E% ?5 { e
3 V1 ~/ {# k( K. {0 Otry 2 N9 { U! O J3 R- d- F; ^8 q
{ 1 Q7 q* b/ [- W$ p, A; W* ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + _4 ?: o% E Z& u7 Q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); c3 F$ Y8 f, w
if (r == vbCancel)
0 P' ^ Y: X$ P. j! i, r- r* L {
4 B0 K4 f2 {: r5 r ? simple.CloseModel(); 6 @ i8 I, h% ]$ g" r6 Y4 r5 @
WScript.Quit(); ) F+ E% e: M- x; Q
}
5 E& K7 e; o' A) r1 _/ ?' R}
( Q M2 `8 W8 k' k5 ] 4 i% R5 K0 L0 \! y5 M$ i% S5 i
simple.StartSimulation(".Models.Frame.EventController");
E2 ~* T; V% ]- F & B- z! Z; a8 y5 w! Z; Q
if (simple.IsSimulationRunning()) * _$ j) G' Q9 L' F
WScript.Echo("Simulation is running!"); # w& M" z( z" W- ^
8 q, N4 I, F* ]4 g
// Wait until simulation is finished 2 H( j. J, f$ W$ x+ o
while (!Finished) WScript.Sleep(2000); ' a! r% R, g: S& @$ Z
0 a% [* q! |5 w6 P# W- u0 y
simple.CloseModel();
& t+ }3 L! F; d$ m" m6 d9 \simple.Quit();
6 j8 o( ?- Z7 LWScript.Quit();
2 X2 L; e' G* g* z! ?: `. H) b
2 v1 J7 B% w3 j / m3 Y1 M$ W8 {6 V- w4 l
function RemoteControl_SimulationFinished()
' i- L" r/ L5 S7 Z/ ~. y{
3 e# t' N$ t5 X WScript.Echo("Simulation Finished!"); |