Example of a JScript
) W. g5 I6 u5 _3 P' Cvar vbOKCancel = 1; 2 x# i0 P" m8 d; }% L+ n
var vbCancel = 2; % r$ a' p7 s2 G0 P S" L% b( T/ g
var vbInformation = 64; 2 A2 ?! T- d/ M! s! S M
var Finished=false; 6 l W! a2 C* R& x
) O* P( c, }. x+ H# m
var WSHShell = new ActiveXObject("WScript.Shell"); / x) ]7 d! F' B8 @5 S) K
% H6 R8 Q( u& q1 l) xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ G! s) l7 N' L$ r. E+ j# h
: s0 B# O' G. J7 x; n1 W- Xsimple.SetLicenseType("Runtime"); 2 X4 y+ V. g. q* p4 d9 T7 c
4 f- I0 v) Z5 O+ j( ztry 8 E! _6 s1 `% y
{ 4 d I# w0 j2 o$ i
// Enter the path to a model file! 3 e" Q7 I7 `. G6 N$ \
simple.LoadModel("C:\\Models\\Test.spp");
1 P. t4 z' l: H! J/ C}
: A+ w+ I3 b2 z- E/ p7 [catch (e) , X4 }' I8 s) B4 n/ Z
{ : ]* E- j) q" g& E3 l
WScript.Echo("Could not load Model!");
0 d6 w" J6 V t3 o( {0 Y/ J WScript.Quit(); 6 G0 C& e% ]8 D5 s1 m6 g7 m9 v
} ! d. L" k& h) i8 m
" s: C1 j+ E+ m, |7 X! E; ]
try
' z2 m* i6 b. O0 t6 o. o) q{
6 {; B% n1 w) M0 A2 _( B. Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 l5 O" a9 E* |" T! G9 } r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - q4 t7 w2 m6 N$ k! w4 D
if (r == vbCancel)
7 W+ A1 h- ^0 J' ^. \ {
/ W+ b O+ A4 v simple.CloseModel();
5 V: S* k& x7 g$ t. \$ M. x WScript.Quit();
* B+ Y- z6 x$ C3 r }
! S6 G/ d8 i q; |; ^} : w& I. g' A9 l6 O
: Q& x2 g' c9 E5 R
simple.StartSimulation(".Models.Frame.EventController"); 2 a+ x! p0 W5 I% W: O( W) ^ q( |" L# R
1 V( P2 O: Z* p8 N, ?1 W, k3 X, d% Q
if (simple.IsSimulationRunning())
/ W8 A3 s5 H+ u' G" F9 r WScript.Echo("Simulation is running!");
, l. L2 p- {6 P4 ^3 l/ m
0 o) C) ~0 \$ c6 P- i6 g// Wait until simulation is finished
+ A2 h; a' I( pwhile (!Finished) WScript.Sleep(2000); : a# e# ]6 _' n' s/ C- n8 S. l Y
) ?: e% C# d5 i) z' t8 Wsimple.CloseModel(); 5 Q E/ r" {- c$ ^( _& O0 U' l) p
simple.Quit(); , J, p( R) M% o% Y
WScript.Quit(); # i$ o2 a$ V0 y3 y
, y$ f- b. U0 ?8 i
1 W/ \" F) ?% V% rfunction RemoteControl_SimulationFinished() , e# i, K4 N& ]- c
{ ) V) l2 Q' [* f0 ~/ [1 k4 ]
WScript.Echo("Simulation Finished!"); |