Example of a JScript
: f8 y2 Q5 Q, ?3 k, uvar vbOKCancel = 1;
; J1 p" n, J. s) Pvar vbCancel = 2; % d5 k+ ?* R5 ^8 |+ ~: J
var vbInformation = 64; 3 X2 U" @. H! g4 Y! G% F
var Finished=false;
5 X3 z4 w% l/ h* ] ! M2 X. ]& L$ d5 t3 k ]* r4 }; h; `# b
var WSHShell = new ActiveXObject("WScript.Shell"); ; l0 b3 n; g2 H
. I2 w% h' z7 v: V# ]6 j3 [- Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 Z0 y A/ H; ^* C- i. t% M) d3 C : o8 Z- v% n: d- J
simple.SetLicenseType("Runtime");
" E! \7 F/ N" o6 W1 x, q- O
' o( k% }# G/ n. G( mtry : C6 Z5 q2 a* q/ Z& p; T) j
{
" [6 K1 T) w+ Y9 |, Z // Enter the path to a model file! 2 v# i* x7 k# S4 m
simple.LoadModel("C:\\Models\\Test.spp");
- u/ I' r: Q( v" L}
' b9 h' y! `" k! Gcatch (e) ' t s. @& I4 V, u5 O8 {1 c. h
{
3 z+ d6 z9 x* m: H; `9 y; [ WScript.Echo("Could not load Model!"); $ ~' ?+ {( J4 ^: X) b& R* |
WScript.Quit();
8 ^* X/ p! \5 G3 D+ N} ' [* c: I( J* c4 n
$ t. E2 d7 `7 ?6 C4 v }5 j
try - q; Q3 A( B5 b
{ $ ^% G- z- m# ]# _; M- v
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! w1 ?, R' L! t8 u" K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
P' x+ i6 ~+ \7 v; o2 P* S* n if (r == vbCancel)
0 L( B% K) K% W1 J {
4 z& s& Z* L0 T J simple.CloseModel(); / a- Z# t" q) b2 K, f# Z& y
WScript.Quit(); 5 J s! ?: f k, n1 x, w% X( ^
} ' x! x/ n! o3 ^: q0 X
}
4 L/ g& P b) ?% Y& |
- ~8 ?5 T5 }9 {4 ^simple.StartSimulation(".Models.Frame.EventController"); 6 z0 P8 z. ?1 w* Q
$ }* f" Q5 }$ L5 [
if (simple.IsSimulationRunning()) # d1 _, _" C( Y: P' i4 t
WScript.Echo("Simulation is running!");
5 B c& ?, N; ]3 b n/ u3 B
% P0 S- [4 x; B) v% D- c, ~) B// Wait until simulation is finished
. h% {4 |' u, V3 Awhile (!Finished) WScript.Sleep(2000); 1 T3 h+ r) l# Y" x; _$ @
/ w6 ]( e/ k4 r( i% Fsimple.CloseModel(); 2 G8 b9 F0 r) u' Q+ p9 M8 R
simple.Quit();
) M" \6 H8 T* z. m6 PWScript.Quit();
# A2 ^8 m" J" h, R
: Y P) S, F# k6 u8 _6 y& w+ Z ! }* a* n. K7 ?: c- k
function RemoteControl_SimulationFinished() 1 K' A4 M; ~. M p) B7 @) L
{
/ U. J4 I4 h0 k) c8 r WScript.Echo("Simulation Finished!"); |