Example of a JScript
" a7 g4 H8 J7 Q" Q4 ^) Zvar vbOKCancel = 1; ! a a j) ?4 O# u: K
var vbCancel = 2;
/ v! T, m6 |: Q ~$ F8 W- O" E- _/ ivar vbInformation = 64; p% Z+ I1 s6 i$ |% t
var Finished=false; ' d, e/ n$ A5 x4 d% t* `1 D0 @
; L* f. _' b& a w6 K
var WSHShell = new ActiveXObject("WScript.Shell"); b8 U7 T& E; } ^: R* X. n
" _8 |7 ]+ b$ d1 R* Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# \3 ^/ ~5 l }" G4 R 8 a$ G: @. _+ o" L2 c) t2 f# n
simple.SetLicenseType("Runtime"); ! y; `4 D; N. E- t, w H7 S9 B6 v# j
. C3 a ?% k2 P5 P
try 4 Z) m/ ~! F# r
{ ' ?4 p# H2 B# c7 t* R
// Enter the path to a model file! . ^7 U5 j7 b* f2 Y0 o* k
simple.LoadModel("C:\\Models\\Test.spp");
( H t A% z8 e' f7 {. d3 A4 n}
[* Z7 Y7 T9 G" M/ m4 Q+ jcatch (e) 8 |6 x" F5 b7 g" I7 `
{
' ~, V! ]+ u; K( L% Q WScript.Echo("Could not load Model!");
+ x. s! }0 X# E6 l, W+ @5 P WScript.Quit(); . m3 B2 q: R2 J1 t3 D
} " I6 Y! J" b8 f/ |
! H: U h# |2 c! a( r5 `; y7 wtry ( K2 f+ w( Y8 S0 C
{
6 q% V) ?' z. B+ q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: S) B- U# k. F2 e5 l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % O& R- E# d) X X
if (r == vbCancel)
6 T* r( R; C' t {
; B+ u$ S9 y9 ^+ r) m simple.CloseModel(); & s: \1 ?4 n1 ~6 f# {. H
WScript.Quit();
6 _' _ L2 C6 v- @ } 6 x! a% j. |0 A7 N9 g6 T, p" S
} 6 m/ D4 W1 B# ^4 H, R0 v
5 p* a5 r6 t9 V' Q) z4 Q: l0 Asimple.StartSimulation(".Models.Frame.EventController"); 8 E3 P: s$ \& P% @1 a. p& j
. x* B- P3 o3 x( Y: Q
if (simple.IsSimulationRunning())
# S6 u( O5 r j; _ WScript.Echo("Simulation is running!");
& b& y& R( b- a r8 g: j6 m2 W: | / J* b# s2 H! R4 d( z
// Wait until simulation is finished
0 ^$ R5 Y3 M2 ~" H% |( vwhile (!Finished) WScript.Sleep(2000);
/ ?$ t3 _0 n, P/ X7 m9 @" R/ V
) }8 Y1 u4 S( [# W% B; ` k; Asimple.CloseModel(); 5 ?9 G+ K U$ ^' `/ [" r3 s5 t! h- K
simple.Quit();
; [& f2 c( I2 ZWScript.Quit(); # N8 r2 x5 H8 P+ b* I5 D
/ q" W) z J! n3 r, w
. e0 t$ H$ e w$ C5 N9 a4 r% _function RemoteControl_SimulationFinished() 4 n, n1 j9 Y" U I7 |6 i
{ 5 N% F+ l5 {4 z. g% j0 I7 y
WScript.Echo("Simulation Finished!"); |