Example of a JScript
5 f$ G3 ^" B' j& R+ u* c2 uvar vbOKCancel = 1; 5 s7 ]' Y; C& R2 c
var vbCancel = 2; ) [0 v7 f& [+ N2 O6 I s! Z4 C' _
var vbInformation = 64; ; q! d: N/ \) o. ^) i
var Finished=false;
3 d5 R1 V- i* X# p* c' K
2 Q4 \: c& q ^var WSHShell = new ActiveXObject("WScript.Shell");
% A: B F) M% s4 `2 v; I. I ; t! m7 O- K* u1 S) z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : M, F* q6 M, N' e7 O( I0 C( W
6 s0 c+ R# A' Esimple.SetLicenseType("Runtime"); , m: w% x6 T! x/ O
; D; a* m" A5 I0 ztry 9 ]8 `% ~ q+ a5 {0 x$ R, Y
{
6 S; O0 P9 S' J // Enter the path to a model file!
8 V; z2 p" f( b5 ^1 q9 J% y& q4 b simple.LoadModel("C:\\Models\\Test.spp"); * B1 @) }' `8 |+ M1 E
}
# S0 {- e( L; t( V+ U! Ucatch (e)
- r" g; ~& n& h5 G, _0 ^ t{
- R, a; c0 w' Z+ A2 W: \# T WScript.Echo("Could not load Model!");
0 k8 q! F( ^) I' N4 c& N WScript.Quit(); ' T4 P! }' {) [- S, v# ^
} 7 G4 o; q! i5 Z t
# y& z% u! J" y: f( y( w% b
try
( c) w1 i" ^- d4 v" B{ 2 a4 p4 `, g3 d/ L3 W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ ?: X! U. N2 Q' r" S r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ o/ o$ A1 ~# T/ z if (r == vbCancel) % I/ d* k; p, t2 d; h+ _
{
, ~6 g2 D! O9 U simple.CloseModel(); . w0 [3 v# A! o$ t/ D
WScript.Quit(); 4 J& b% U Z! ` {- u6 S: y3 z1 G
} + x; i/ z2 V) X( P
}
h( o9 S4 ]6 \" n$ m u o0 O5 Z# J Q
simple.StartSimulation(".Models.Frame.EventController");
" f9 C) g* F4 {4 p7 t6 ^
! E: L! @8 P4 p0 M3 hif (simple.IsSimulationRunning()) & |. P, r5 {& p5 H5 l `' D4 g
WScript.Echo("Simulation is running!");
7 C$ X; L8 F9 d% q ' h. P, f. m3 R: Z3 V0 h
// Wait until simulation is finished , E' z3 d3 W4 T5 e
while (!Finished) WScript.Sleep(2000);
6 s' N9 @- c7 z& v
' ^! ^. K' \6 c5 ^: a( p7 B2 msimple.CloseModel(); : x) A |1 L8 q% \
simple.Quit(); $ d% {) `" y+ {: E5 C( P2 C: D
WScript.Quit();
! h( L5 f" k, l2 I
4 ?% _& t! i/ Q' C
* e* Q6 h; N3 C+ p' s* s- H- sfunction RemoteControl_SimulationFinished() + P* }7 W" X4 o4 k
{ / V0 d" m1 ~. B. v; z3 D
WScript.Echo("Simulation Finished!"); |