Example of a JScript # q0 C) _0 g2 w# [. l% o
var vbOKCancel = 1;
" o6 L8 U, ^9 ]$ V8 U& P4 L2 ?var vbCancel = 2;
2 |3 Z, j1 i3 C* ?var vbInformation = 64; 0 ~6 q' `1 Q0 m0 n' q! S! l b4 E
var Finished=false;
% z M7 \" P$ t. }
- |# G+ p) c( P( k: F( pvar WSHShell = new ActiveXObject("WScript.Shell");
' X) T' \5 N3 w9 [6 C
9 v$ c$ [; _0 Q( l, Svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- @' y4 i }( f9 i . Q: v) H" g4 l1 E1 ]
simple.SetLicenseType("Runtime");
1 z a# C5 p& w; |
6 v# l0 u/ g0 rtry 1 ~- A: g' [! t; @9 N
{
4 j$ R) O6 G6 n; f% g3 i // Enter the path to a model file! 7 h' v, s& T+ ~! x1 m# A
simple.LoadModel("C:\\Models\\Test.spp"); / G4 d# I( @/ [7 j2 V6 M" L# c) M
} ! y$ v3 D0 O1 p- l) `2 \# D* |
catch (e)
( Y$ x9 h. l# N l1 S' O{ 8 F7 @( \6 ~6 H! q) L! q- ]9 C
WScript.Echo("Could not load Model!");
! i, v3 \$ {4 v# B# A" \9 W WScript.Quit();
' m) w) @, R; @* J3 {+ E}
# S4 B) o+ Q' h9 i1 a, o0 \
# L2 s: G/ d7 h6 T6 x% L, m9 \. Ntry
l1 f5 u _% z& `{
3 Z+ I" C' z2 ~" t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; `2 |4 z9 R8 w4 Z {- A8 [0 u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 i% g0 x8 y! E& o/ k- ?! q; b: U
if (r == vbCancel)
. W( E* {5 A9 f- o+ | { ( F! ]) D \6 Z9 ~. B8 C
simple.CloseModel(); i0 T2 t+ R7 ^6 h
WScript.Quit(); 4 E# D6 k, V( R, [8 @, X4 d: d
}
9 \8 E$ m. k I. U} 4 ^1 ?/ x$ F+ {4 [- p$ S
" K; B; d& f1 U4 B# g# |' p0 Y
simple.StartSimulation(".Models.Frame.EventController"); ' }# V1 d0 Y, x6 G' a1 x
) _. j& }4 F: z" ^, B1 U
if (simple.IsSimulationRunning())
1 P: s' q6 R; j3 E# B0 a WScript.Echo("Simulation is running!"); 8 W8 H* u. b2 M
5 T( W E4 \0 r/ }. @
// Wait until simulation is finished
- Z, f, c0 l. A) X8 V- A) R- Kwhile (!Finished) WScript.Sleep(2000);
( n5 g9 Y0 R) K * T% M0 n) h4 g9 D: D+ p
simple.CloseModel(); & u0 M8 Y3 z5 n( S
simple.Quit(); % M; q& q: z$ _" H
WScript.Quit();
) {- J% Z' u, M
) _. X: ~! D `/ @5 c
$ m5 i9 i& p" ^& I, Gfunction RemoteControl_SimulationFinished()
' y+ F" B& K/ j) U& k& O. u{ & [+ x, D7 }, y9 o* U- K1 P
WScript.Echo("Simulation Finished!"); |