Example of a JScript
0 C# G } Q, C3 o1 f+ ivar vbOKCancel = 1; 4 f) Q$ M' w, @* o3 R# e) Y6 [
var vbCancel = 2;
' W7 @, L/ q+ U# g; x# Gvar vbInformation = 64;
; Z% `. s# ?/ c# V& Z& ]' C Nvar Finished=false; ! U2 w1 {6 E' A0 `( _& z
@1 @8 ^8 H+ v F5 ^
var WSHShell = new ActiveXObject("WScript.Shell"); 6 h; _. d( I n1 I0 w& q7 `
" e* O5 {. w+ i* {6 K
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & V" h) v b8 A$ h7 `
$ B$ a$ `; i) ^4 d; s j. q8 x
simple.SetLicenseType("Runtime"); % r/ f( k( m& Y9 f, w0 ]/ m
, d. f9 \3 z- U. o. d8 t
try
9 U5 t9 y" T4 a" N) O{ * n1 g5 O; ` c8 @
// Enter the path to a model file!
, S, Z+ k) T6 R, U simple.LoadModel("C:\\Models\\Test.spp");
) c: q f7 J) Y}
5 l5 T9 |- c9 {- b+ _. {( l" Y1 z+ |. s- Dcatch (e) , M1 l2 h* l/ }" C4 o! g+ D- S
{ & o' T, @, @+ z: b! w
WScript.Echo("Could not load Model!");
" J" ]( v6 `* x3 X7 I: I WScript.Quit(); 0 u2 J* g; t6 [
}
' P9 T2 X8 b. i* L5 }2 f
+ N' f3 w) ~5 H- h, H$ t6 c- ^/ |3 N9 Ttry " Q- X% `5 B; n# t( R4 \9 i `
{ 4 Q9 _( l( W6 v
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ B/ b, ~3 X- @4 |2 w: g$ O0 Q2 v' U r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : K" {2 L8 W3 g6 G0 L$ C
if (r == vbCancel)
2 C, P8 {+ @5 h; Q7 d+ m2 [ {
7 ?# K' ^9 O9 ?4 V+ Q" O, A9 n simple.CloseModel(); # i0 M' u" V: G
WScript.Quit();
6 b, Q: w/ r- ]3 R. Z0 d8 O1 I } $ F+ r/ |' t4 `1 C, c3 H
}
2 ~7 e' ~, V7 t7 D, B& [ " F# h; Y0 {2 X5 X# i- s0 ?
simple.StartSimulation(".Models.Frame.EventController");
# L3 u0 ?" |$ ^6 _) s + U- V; z2 B+ V9 g. C R
if (simple.IsSimulationRunning()) 0 I! n5 T: v; H a, J- v
WScript.Echo("Simulation is running!"); 2 t. f9 h, N( k' R& x( F9 H
6 o; M) t! j$ w V- Z l
// Wait until simulation is finished
8 O3 `6 T1 s, `: w; R E: Jwhile (!Finished) WScript.Sleep(2000);
" k' `6 g) l( U* C4 M
$ Q3 C* [2 y9 k& b& B) wsimple.CloseModel(); 0 m+ F) r0 u9 n7 t7 x
simple.Quit(); ' D. n. K; v9 [' L
WScript.Quit();
% D9 a+ f5 A; o 3 s9 N; I R- B& ]" [, y
) J( _( c/ Y; n3 S! X
function RemoteControl_SimulationFinished() - l8 j( ^) s7 s% ~
{ | b) B. L( N5 U+ |0 q4 V. i
WScript.Echo("Simulation Finished!"); |