Example of a JScript
6 j! f# ^3 w& C3 ~8 Svar vbOKCancel = 1; $ \4 e9 b9 I& q" G
var vbCancel = 2; - a0 _9 O+ m9 E2 V8 T [
var vbInformation = 64;
* J1 |: S& l; ]5 H3 s: \0 d0 Cvar Finished=false;
3 L0 \0 l$ w1 n5 I5 E: F4 i * R2 S7 f1 m* Y) |( W5 y* @
var WSHShell = new ActiveXObject("WScript.Shell");
) t" w" b5 }/ J% ], E" b9 L2 ?# W * u4 x- T$ ~& E4 j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, c/ e' R0 O6 P1 r; T0 \
# t6 p- C& P' c4 ?$ O' _simple.SetLicenseType("Runtime");
' I7 K- W5 h2 t1 t$ w % [7 G# [: f9 N- {- J. T4 n$ @- z
try 4 D% a# J$ @; a9 x# b$ h
{
5 q {# e' Z( ?7 Z- m. |: V // Enter the path to a model file! " J' H4 {& }2 M3 x% s2 e( L
simple.LoadModel("C:\\Models\\Test.spp");
* w) H! l* _5 E" w}
! h; x+ `/ J, C* q3 ]* }. k6 m- f Mcatch (e) 3 Z" v2 B" s3 F
{
4 z* N1 x, E6 v WScript.Echo("Could not load Model!");
3 w: ?9 }7 [5 X, d6 V$ R2 }" X WScript.Quit();
4 O& @8 E5 g& M) d' D- W. ]/ l6 S0 V+ ]} 4 ]& y, [: X2 ^" T% o6 q5 y
1 z! X( ], c( b! w
try % z. W7 D& r8 c0 B- I- a
{
6 S+ Y3 J4 ]. Q0 ]4 s2 w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 b2 p$ o8 _5 g6 Y) [# H, p% W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . s+ @' b6 s. J! w4 H
if (r == vbCancel) , L4 N. e. S, p+ s
{
1 j3 \4 t8 e. f# L$ n simple.CloseModel();
* J) ^5 D% M3 Q7 L WScript.Quit();
9 Z9 u0 A/ F8 p. N. y, |: ` }
5 C7 f1 K6 e, V; i}
* o8 ?1 _) w$ H4 b2 I% z( J3 \$ S
+ |: O- O$ R ^simple.StartSimulation(".Models.Frame.EventController");
- x( c5 C$ g& d% k/ e$ o3 q ! s8 V0 s. _: L3 k4 V/ K& x2 o
if (simple.IsSimulationRunning()) 9 V; ?2 I( p2 R2 y9 j' Q
WScript.Echo("Simulation is running!");
/ w# Y6 |4 |! d* ^9 D4 s: \
! E0 M% Z0 b2 F" E3 M7 D7 l$ S// Wait until simulation is finished % p. B3 Y7 Z! f( P# Q: F
while (!Finished) WScript.Sleep(2000); ; V8 t u! C1 c2 ?
6 c) y' C+ K) J/ E
simple.CloseModel(); 2 Y5 @; {2 V1 _; ^% q1 ?+ W
simple.Quit();
- R) O$ i. e lWScript.Quit();
" |8 X/ }6 J$ d * Y! |9 z' d4 v' h0 N
( n( `1 }5 N8 H7 w+ ?: {, Xfunction RemoteControl_SimulationFinished()
- K2 w! I0 p$ }! Z0 I8 @: \{ : t0 r/ k" E8 o4 K1 Z
WScript.Echo("Simulation Finished!"); |