Example of a JScript
1 Z" [& F8 z- J1 [9 k$ k- [var vbOKCancel = 1;
% ]! [- g Y! K( lvar vbCancel = 2;
3 M, G# ]& @9 A& z6 bvar vbInformation = 64;
/ R6 }: m: M5 o8 [/ Pvar Finished=false; / s& \% g) N4 h8 ~* m
) n" P- D: b: y5 m
var WSHShell = new ActiveXObject("WScript.Shell");
& d* Z4 k4 _4 q4 t7 C
7 M4 ~ k1 Y! s% Rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , P S0 F/ n, X8 a0 P3 _) U; F
3 {6 ~" v, c9 Z1 L1 _4 @
simple.SetLicenseType("Runtime");
M1 Q( ^% S7 N3 G
# b$ X+ z: h- u8 J) y+ U k3 k/ itry
6 F# B6 y' R7 w) O{ 9 ~9 s& T$ i! l! X
// Enter the path to a model file!
4 U* @4 T8 X/ ?* X' l$ F* j simple.LoadModel("C:\\Models\\Test.spp");
! b* [2 p7 I4 L. m' w" l}
* R% Y+ M% F6 h! x6 U4 }catch (e)
5 \; U; F4 h) A/ c F: y{ 5 i; ]$ P- c; Y3 g1 \- u( u
WScript.Echo("Could not load Model!");
, f4 P3 ]+ y& f2 N WScript.Quit(); " e6 I' i& X% L- v
}
4 F: e5 A7 `: h+ C4 i( y
' O8 |& b7 S G8 ^1 n/ V P5 xtry
1 f( v1 r+ Y% U* O0 n0 e{ & j& u2 B. `' s0 i% T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # c" K' F/ t1 s( U2 ~# t3 \0 ]
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 {. `& n4 O4 B if (r == vbCancel) 1 }- P% |- B; f
{ 2 H. t9 h! ?/ x m3 U) D9 Y, K
simple.CloseModel(); 8 A% L! h& _9 [( B8 V
WScript.Quit();
/ |/ H3 U' {$ F* W: K# x } 1 K: U( J& e( I% ^
} $ M5 {; ~! k8 \4 `& [
# H6 \1 i& E! ?6 y" \
simple.StartSimulation(".Models.Frame.EventController");
- _! K2 q" ]* C0 o5 Z" t! @
' b8 I9 O( ^- {* {; q1 xif (simple.IsSimulationRunning())
) Y" Z: ^3 r) E. p WScript.Echo("Simulation is running!");
4 J- E; t/ ^0 H9 d/ b I& l: T 7 ~5 C. F% J5 X0 i. C
// Wait until simulation is finished
. J; f4 r& X ?3 I9 X2 Zwhile (!Finished) WScript.Sleep(2000); 9 h: X& j: x$ q/ |
( l; f% Z. M( b4 u4 ^; Jsimple.CloseModel();
- M5 ~* j# U, O( v6 w% T5 f5 [ @simple.Quit(); 8 N9 e8 u5 D; O2 G, ]% J2 x
WScript.Quit(); * U! K) B& s1 H
& P0 `7 A1 ]1 M [0 ^
y: T% |. n0 h/ C! c+ B5 ffunction RemoteControl_SimulationFinished()
: L6 `$ B) C0 y0 ]0 D{
; Q# H0 e! ~ \( [2 W' [ WScript.Echo("Simulation Finished!"); |