Example of a JScript
2 a" g$ ^$ ]. g1 c. fvar vbOKCancel = 1; ' y4 X* u1 e8 m! ]+ g/ p7 {
var vbCancel = 2;
. Z" C9 q( [& Z4 Q4 Zvar vbInformation = 64;
7 k0 t. c* u$ E8 Fvar Finished=false;
7 I" i, ]& r3 w+ o# ~2 T$ l
0 y8 L3 n- O& ^var WSHShell = new ActiveXObject("WScript.Shell"); , n# d* L2 ]7 _6 a% F( v
4 h, B# D" o# `( T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ L9 R/ I0 Y3 [& l0 I" M
: `% M; x6 T! }1 {1 k3 c8 Bsimple.SetLicenseType("Runtime");
- l' t9 L% y4 C( r3 X! Y
$ E7 N1 F; |# E3 B6 {try
+ o5 P3 c& D$ U{
& Z" S4 }/ C& }& u // Enter the path to a model file!
: }3 L* m; C" N2 L simple.LoadModel("C:\\Models\\Test.spp"); & ^8 w- T7 v w7 c% R
} 7 s+ r. r0 E: C: r6 \, E
catch (e) 0 ]1 F5 W0 @$ F# P/ o3 }* p1 g
{ & V" w) I& K0 ]- j9 g0 p2 I& C
WScript.Echo("Could not load Model!"); 6 g3 n& B; `( H3 N- R& z
WScript.Quit();
2 _( [3 H: _. k% [} ; R+ h$ {" I6 g+ W
+ L( p+ A9 I; G% k3 Dtry : k- n& y, ]0 I& ^. r# y
{
) |; S% A# v9 a: d4 y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . q5 J) w X6 d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 r" R! C* `( \8 r! ~' n
if (r == vbCancel)
/ ^8 {' ~: o! ~# |% Q {
) W# s4 b$ @5 I4 W6 K* v# W simple.CloseModel();
0 Q3 l8 B! m5 n( p0 d6 Y WScript.Quit(); 6 S6 ?# i8 _3 A( \( f( N
} ; A/ x' s& @' z
}
0 e( |! B) d5 @" A 7 P9 r- Q: e8 _4 ~9 P3 |
simple.StartSimulation(".Models.Frame.EventController");
% H/ R. c/ l+ B/ Q. Q# S9 h
. I+ l* N1 h+ aif (simple.IsSimulationRunning())
6 m/ ^/ o( c: y3 ^ WScript.Echo("Simulation is running!");
* B$ N6 O; X7 \
; u0 z2 ]6 E- c! r2 `- X// Wait until simulation is finished
7 X' b W5 e/ D& g/ N& c5 ywhile (!Finished) WScript.Sleep(2000); 2 {& p' F2 x) y' O, x
" s' C2 e' Q& C
simple.CloseModel(); ?. ^9 G# k* }% F* r4 }9 A# I0 m6 m
simple.Quit(); r/ y" ^, s( v4 m6 _/ n; C
WScript.Quit(); * X9 g( m1 F6 d' L& Z
2 X$ N* N: g2 T5 c: [# E
. u. S4 D" J9 Z3 Sfunction RemoteControl_SimulationFinished()
" G9 [% U/ Z! q{ # R) |# i) X$ J+ ]& H5 b0 D& b
WScript.Echo("Simulation Finished!"); |