Example of a JScript
6 D! c4 p% f2 R# Y1 i8 R% s& Ovar vbOKCancel = 1;
. a x1 P' [; l* T1 {, Jvar vbCancel = 2;
' \/ A# z& r/ d+ |% l0 Lvar vbInformation = 64; # [# c& @ X6 p+ p( x
var Finished=false; 2 @/ l/ u1 ?/ ~; D( \
: z/ w; [' w) E! B. p5 W! N/ F2 C
var WSHShell = new ActiveXObject("WScript.Shell"); & b5 Q4 i2 ~9 f! @6 X
: Y3 ?' g! y* E/ E; X/ f% q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ J1 v% L# J. G. R: B _( {
; l$ I: q! x* |4 C' xsimple.SetLicenseType("Runtime");
" x! W* {% I l0 g2 D# F K
: R, T- A) e+ k8 `+ P. Ktry
) b$ P& p( l: V' i; @{
$ K! F2 A% |% ]) X // Enter the path to a model file! % T. d9 a% H: _" m+ t& ?0 S
simple.LoadModel("C:\\Models\\Test.spp"); ! b: D6 {# r/ l+ c& a
} : X8 F' d: z2 C
catch (e)
$ {- Q( R$ r3 m4 w5 J8 U{
5 s0 F# _" A, `+ t" K5 T WScript.Echo("Could not load Model!"); / U: O4 T- _ \% j4 \& V5 Z
WScript.Quit(); 3 Z: ]3 Y0 S$ P% _7 e1 p
}
3 n$ G/ l9 r" b% {( P6 g/ |" ^4 \6 ]; u 3 y2 a5 k9 \0 H) M3 I
try 6 W7 R/ C; y/ L" g, |
{ ; h3 h+ v2 L, }0 @' n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; s3 W# L( X/ Z) R5 o: j+ g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 c( f3 }4 J! `% F' I! C, |, q if (r == vbCancel) 9 e& I+ P' C, N
{
3 ?# k7 Z Y/ e4 O simple.CloseModel(); ! y6 o- O( t: B
WScript.Quit(); : z# g5 b' G; e6 F6 Y. o- h
} 5 d3 U$ H x7 Z8 L6 i) s3 i: ]
} 3 W7 G6 I, q0 o
* q! I. o, c5 U: w0 h) @3 ^, T# A; o7 Lsimple.StartSimulation(".Models.Frame.EventController"); 4 c* L! ~0 T- y; O* \) b6 l
4 C. h: X% Z! S' c4 U1 B
if (simple.IsSimulationRunning())
; {% c( k4 E+ Y8 l% I- r; H WScript.Echo("Simulation is running!");
) v! i2 g( o8 I& L- ?
$ S7 k, u9 p0 p" w q// Wait until simulation is finished
) e; g" [, q! B8 Dwhile (!Finished) WScript.Sleep(2000);
, s8 W; U) c/ ^% M0 c; J c 1 p* l3 d3 |- M' J" q! {
simple.CloseModel();
- B& D; U, {- h( \simple.Quit(); $ Y8 W4 ]8 t) o- j
WScript.Quit(); 1 ^1 B/ S/ I6 [" K* g: [8 N+ R- M. k7 T
y+ ^: j( U$ l+ W; H
. i W2 ]: B' B& E0 W0 }5 Q% ffunction RemoteControl_SimulationFinished() 7 x) G, X, w# D( l
{ % v% |) ^0 }* s/ N P. R
WScript.Echo("Simulation Finished!"); |