Example of a JScript
i; w2 Y; a9 F! t7 D; ?% Kvar vbOKCancel = 1; , D1 Y% i0 f5 m5 u c. y/ \
var vbCancel = 2; # H$ B- p$ D+ h/ ^) i
var vbInformation = 64; : p5 j+ _0 t0 q# u1 T; \
var Finished=false; # ]' F+ N1 ^% b" k- N$ `
' [/ q: A) l# k6 F0 N p
var WSHShell = new ActiveXObject("WScript.Shell"); 7 _% E" V _* v# C0 E
1 i* J) h# p/ h3 S( |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + ]9 @) t, g5 ^/ e
. k' t! l% @, ?3 q
simple.SetLicenseType("Runtime");
% {- \0 ]% u2 A. i$ F
: g' u2 q% S2 n# Htry
% f) w* E- p, q3 ?{ / W1 e- q- X$ b
// Enter the path to a model file! ( i7 t. S0 a7 z ^/ g Y: Y
simple.LoadModel("C:\\Models\\Test.spp");
$ t( L" i7 S9 f# r+ @}
l8 G% E# ^$ R& _$ ^; n/ xcatch (e) / s& J R* I+ ^, [4 C4 x' T( [
{ ( g0 V. g6 ?+ ]0 u% Q$ z5 r
WScript.Echo("Could not load Model!"); $ V) }7 k( O4 x }
WScript.Quit();
9 x/ I' ]/ m/ \$ V0 c3 n6 W) ^. |} 3 }6 R6 [* V4 h
4 j% z T& y. C1 Qtry
# ~( [9 k3 C+ b+ Z{
* g6 V1 g+ o0 C+ j, I+ T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # b) B% ~- H7 G: X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
a$ u0 S B; \ if (r == vbCancel) 8 T& p R8 d6 @
{ $ n. G. |: K, Z2 p; Y8 @
simple.CloseModel(); 4 D0 V2 [6 F/ a% o5 ?6 y
WScript.Quit();
1 S) {% r; B& }) l& I }
- n7 a* _- r, M# ^5 b} 1 R6 S* n' O9 n
" Q0 L0 B& {+ P3 g8 O3 ~& x& lsimple.StartSimulation(".Models.Frame.EventController"); 4 n4 M: v# V, a; K
5 x8 P f& n- S8 q; c
if (simple.IsSimulationRunning())
7 m5 U" t! y0 R a) `: l, [8 h WScript.Echo("Simulation is running!"); / k0 Z7 T! O+ g& `; L" n9 z
% Y6 g+ _- R6 M5 d, @
// Wait until simulation is finished
" t6 Z0 m2 j+ i w8 q/ [0 bwhile (!Finished) WScript.Sleep(2000);
* B/ p- A+ h L& d
/ |# X+ F' w: B( f+ ^# g9 gsimple.CloseModel();
5 Q' G2 @9 t4 g, ?simple.Quit();
/ o$ F- _0 g1 WWScript.Quit(); : Q, N% c, ^& q4 ?$ F) h
' U' m% Y. l5 C& K. X. o
: S" n3 \/ @' f0 a" {. {; x' C9 lfunction RemoteControl_SimulationFinished()
. Y% q, t7 G8 V( o7 M{
7 _' ?/ H3 F+ U- U3 m WScript.Echo("Simulation Finished!"); |