Example of a JScript
4 b5 [4 {' `1 X% X* J E$ \var vbOKCancel = 1;
7 w" _* R9 j6 H/ J: {9 zvar vbCancel = 2; 7 G' y; `/ S& x. I9 l
var vbInformation = 64; * m% P1 l: N4 I7 N
var Finished=false;
( D n3 q0 w/ ]2 A
! O. ]0 {0 g/ e Gvar WSHShell = new ActiveXObject("WScript.Shell"); ' }8 c/ ]; p' g. D0 B5 c
5 u! H+ s& }1 H" u, y- h, avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( L4 q7 {) e; s/ e: i' d
" p5 `/ \# ?. y: ~
simple.SetLicenseType("Runtime");
2 d2 t0 L9 u8 M+ I
* B" R1 M0 X, G: ]; Ctry
7 }5 ~/ E P/ H! r* [{
2 S" J+ U' R$ D% I9 n3 T // Enter the path to a model file! + \0 d6 c0 c/ x1 ^
simple.LoadModel("C:\\Models\\Test.spp");
$ W* e2 k0 A# ^' `# m}
0 e r+ V; l1 E2 h0 d% M+ Z& T: P/ h" Ycatch (e) & L; \* B; N$ o/ q; k: h1 {
{ ) e' ~% G- i0 x9 s4 n
WScript.Echo("Could not load Model!"); / `4 l1 n3 K7 ^; ~- h: J
WScript.Quit();
, M0 E o+ z. d: z4 t( Z' r0 ?} ' W8 c7 `$ i5 J9 w2 y
" L# c0 D. e. L
try ; a( u# V& d* \
{ % t; C* E/ E% a* ~% A/ J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 q, @2 b* Q$ y0 X+ } U, o
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" x/ D% ]! P$ R" M3 E V if (r == vbCancel) , s# V9 _2 i5 P$ F
{ ) b) o+ o9 G( ?
simple.CloseModel();
4 x1 \& d: |: e; g1 j WScript.Quit();
% N/ Z5 D! y' S3 E, L6 c } ) B9 p! k/ C+ k9 s: p9 i2 Z0 {) ]
}
& T7 [) @8 H$ j" E1 {6 d & o3 i6 \2 J* m5 Q5 g; k8 [( J
simple.StartSimulation(".Models.Frame.EventController");
. k5 \9 j/ v: ?0 X 5 G3 d5 o" P; V Y/ ~) Y
if (simple.IsSimulationRunning()) 7 M2 ^" Y9 n" {" D
WScript.Echo("Simulation is running!"); : Z, W, a m$ E3 |1 [2 z& f
$ ~+ j* ]; J# V! b; _" m// Wait until simulation is finished
, `, \ K8 [& H, c! e& G; U: Jwhile (!Finished) WScript.Sleep(2000); 9 t- m S2 m4 V0 f3 h2 i, O
2 p! N4 Q+ e( T" p- z$ f( j" o& f
simple.CloseModel(); : q" D! q# B) u
simple.Quit(); . C/ ]$ J. P( N {. C. F
WScript.Quit();
# D6 e* H: h1 A+ { G
0 u) X' D4 X5 X) J' R1 F" z
, c! P- {. r i# i/ U2 s6 s# `) Ffunction RemoteControl_SimulationFinished()
* p5 K3 R3 }: ^7 K; Q+ L/ L{
" K1 A8 b. [( N2 ^, D; Y# F5 D WScript.Echo("Simulation Finished!"); |