Example of a JScript
- _' _2 a, K- d1 Lvar vbOKCancel = 1; * g H% S8 \0 r$ s4 O
var vbCancel = 2;
S9 ~" a$ c/ uvar vbInformation = 64;
) C! z8 R/ W8 Q. d$ tvar Finished=false; 1 p" V6 v7 r2 T, W
9 r" \, P& j& w% I. H9 `) \5 b9 m7 dvar WSHShell = new ActiveXObject("WScript.Shell"); & D1 w M. S: N2 W
+ Y! C2 @* f+ M0 p' R- o+ uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* O5 V2 R. b+ B- H: h/ ] . h% u( E/ c9 {* c, O
simple.SetLicenseType("Runtime"); : y4 z8 U" V4 _. J# i+ \+ C9 k
, i0 u7 T2 V) {4 x
try - c" ?! E; v A% |. c2 B
{
, T1 w3 L) P! w5 g5 B0 y( ? // Enter the path to a model file!
" V, `. y! W% h: P, L" g simple.LoadModel("C:\\Models\\Test.spp");
; h* I- |5 l/ |} # H; J$ M3 k& R5 b
catch (e) 3 z; T! r- ~ {2 ~( }
{ * F/ t' s% Z* U, a y5 E
WScript.Echo("Could not load Model!"); 3 ^- c6 o" P B4 l( `
WScript.Quit(); 5 D5 l' o' Z, l7 n- w
}
9 _9 \+ F- I- {4 A( }. Z3 T
9 v. s! w/ N9 b- m/ @; Ctry 8 V; {- U9 f; e5 x* `/ }
{ 4 I! q' g: ~$ a2 ~! l3 `
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) ~7 U' ]7 M. j2 E# l0 |2 @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; U1 M, v. z, W! ^! f. I% ~
if (r == vbCancel) : s7 P" H, C0 a" L. ?
{ * D P, ?* `1 Q
simple.CloseModel();
+ o6 _" T; } S& H* ]' B$ [ e1 c WScript.Quit(); ( | C/ R" L4 R
}
! D+ d) x' } ], V) b. r}
* W& y4 J* w. P& m* U9 \
- v# G8 D- d* B! _/ q4 esimple.StartSimulation(".Models.Frame.EventController");
9 _7 S" [8 H1 A5 D7 [0 g ) y" T* g. Z* O9 `6 e8 M
if (simple.IsSimulationRunning()) 4 P- P I' }4 S- u
WScript.Echo("Simulation is running!"); 0 h7 P4 S9 [! m$ F" N; w7 {
; @5 K/ t. Y+ p' p3 Q
// Wait until simulation is finished
! j) J+ `+ N I$ M# |while (!Finished) WScript.Sleep(2000); * l5 d- ~) G) O b
9 G" [. P5 p/ ]( y5 Csimple.CloseModel(); ; Q+ R! a1 k. @* z. Y" M& K4 l3 l
simple.Quit();
- w. f4 L$ E8 i0 S5 _: cWScript.Quit(); 1 T H6 [7 G+ P# r2 o5 M% @7 B1 b) ^! a
( A/ V5 R. z4 |% R: D; p e
; G U; P1 n6 b% P W
function RemoteControl_SimulationFinished()
9 {. E1 ]3 A0 m9 _& N* k{
9 T& ~5 `: y$ u# I& y WScript.Echo("Simulation Finished!"); |