Example of a JScript
2 y- E7 e4 x( `( l' Xvar vbOKCancel = 1;
% z$ ^$ Q) z$ d& B; ?2 wvar vbCancel = 2; c$ @7 c* b6 v
var vbInformation = 64; 3 L, @) D, C3 M h( A ~
var Finished=false;
9 y) |# ?5 ]/ i8 H* n
4 C" Y. j( e3 c8 `6 m: n7 q( c; M- m! h" Zvar WSHShell = new ActiveXObject("WScript.Shell"); g! x e/ C% i
& p3 A1 h: A& y' j$ h) n) i3 Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, c u6 z% |) j h( i% d4 ?3 |- f1 T
7 r5 J* \* c) H e- L6 X9 J% Xsimple.SetLicenseType("Runtime");
, K* q0 S2 H$ H$ N
% e9 R" b, \' b. ?( l5 I1 ]- utry ' H: |- ]1 @. ]$ C+ x- I: H
{
2 b' L. C8 E' A0 r3 R- S( j // Enter the path to a model file!
$ A! z) Y, s% t2 `2 g simple.LoadModel("C:\\Models\\Test.spp");
, l' C. t3 H. N} ( r' d1 V0 [0 H8 y% f" A
catch (e)
' }5 q: r% T( s9 L0 i{
% _* J% } e' J* r _! H* J. I WScript.Echo("Could not load Model!");
) H1 }( G+ h/ Y, H" q# G WScript.Quit();
( A4 M/ Y) O" s6 {, y3 Z* k} 1 }! i. ^& S, N; }, i- H, O
* y" C8 N0 P: X
try
9 a; }( C' U7 X7 C- d5 t3 O) I{ : e; h; w$ Y1 o- n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 h% P8 y9 _- n2 W2 R, H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 P" [5 W* {5 L3 u9 ^, h7 v$ u if (r == vbCancel) . l# D% o6 H6 P' S1 n' v+ X* M
{
4 g$ h9 k& @" D simple.CloseModel();
! U( K1 U& c. l8 k WScript.Quit();
4 p5 t% t: \; @3 J) j$ } }
/ L1 q1 k% K0 F) c, v+ B} % K# b$ P' \; i+ V% V" T
" b* W5 B; b: s8 I( Q0 @' V msimple.StartSimulation(".Models.Frame.EventController"); , V) K1 @8 d/ B; u' f
. Q- B$ t, T/ ^9 N! x) }7 Cif (simple.IsSimulationRunning())
* @9 ?+ }) P( \, z8 k WScript.Echo("Simulation is running!"); 3 N: v% m' C: V* Y, `
( C4 P( a4 S, G// Wait until simulation is finished 0 k) `4 \' v4 ~* a. @! L
while (!Finished) WScript.Sleep(2000); ) h) m! |2 A; ]+ `
9 |- R1 r5 h' o) N$ }
simple.CloseModel();
# H/ h. W- v/ Xsimple.Quit();
: F# \" B0 g4 ^: K0 CWScript.Quit(); / `; h$ ^) _) n# T6 {$ s+ f" a
u# U3 n) L4 ]: g5 U6 E
+ C7 Y t7 i! j- v" k
function RemoteControl_SimulationFinished() ) e# k; o1 T1 V0 k
{ . @+ s u+ ^$ \* {
WScript.Echo("Simulation Finished!"); |