Example of a JScript $ \3 T) l1 U6 o8 Q, M
var vbOKCancel = 1; F# b* b9 P; I6 K
var vbCancel = 2; * [" K% F% R3 j, Y# M
var vbInformation = 64;
7 z5 {! G6 \- F6 t( nvar Finished=false;
0 _3 M0 F# ]0 t( }9 l- ~
3 ?" r( J& h+ M2 t: U2 O! c" Rvar WSHShell = new ActiveXObject("WScript.Shell"); , F6 v* h4 c" K) G$ p$ J( f8 Z( A
$ t0 ?, l% D& `% e0 `( E8 ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 S8 c" t% J3 D `
- M0 @9 b) A& a- Z0 U. a+ |simple.SetLicenseType("Runtime"); 3 ]9 B- ?& [0 [6 g g
; G6 Q( ~2 A1 W* g8 W, ?9 b+ ytry
& W* F5 X- |2 h6 u0 X6 ]{ " z2 P! {3 N4 m
// Enter the path to a model file! * n' T: A! a& s: x9 Z0 J
simple.LoadModel("C:\\Models\\Test.spp");
" P3 _7 b4 {3 ~% q, H& h' t1 d} 1 |, b; T7 Y# ~) ~5 `2 a
catch (e) 6 y U& ^: Q8 x, ^1 M; V2 ^; ~
{
# R( Q, L" V, `) A* A WScript.Echo("Could not load Model!"); ' B1 E7 O* f c0 X# k( q: u* J
WScript.Quit(); ( F3 C( a; _: t6 r% ~4 M! t( a$ F
} % q) E M4 K! o0 k' ]
( @" {' F. L; C
try
. `5 M6 W' o% D; `0 N( c{
# ^" c. V: ~8 R1 L" ? simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / K' Z6 J7 z# G" H! r
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . `. T$ k' e# s) ^- g
if (r == vbCancel) + q* S! s3 N5 @8 }
{ + u3 |" w& F% K3 G* J/ V
simple.CloseModel(); U' J0 X, Z9 Y4 m
WScript.Quit();
/ T; g, b& G, f. n1 y2 }5 g' _ } ( f5 A4 l5 v9 k7 {8 W
}
% c) k* J8 k* x) D% L/ Z
" h9 D% B' G6 p- F9 u! X) X, j& Lsimple.StartSimulation(".Models.Frame.EventController");
9 [' c( G) s! E- A6 j9 I* N- l * q2 `* @ v/ d3 K0 `! L
if (simple.IsSimulationRunning()) / [- ~0 b" e3 v6 Q
WScript.Echo("Simulation is running!");
/ R' ^$ S& U# e2 T2 [- c
2 ?0 |: L' K! V c' v+ l) l6 ?// Wait until simulation is finished
* i. I4 U9 C& l2 P4 X0 r3 fwhile (!Finished) WScript.Sleep(2000); : q9 u2 N9 _7 J
/ Z% s6 Q& `4 u' l; hsimple.CloseModel(); Y! I- A4 C0 |9 o
simple.Quit();
+ [4 t% \8 {/ O! |: Y0 Q* T8 IWScript.Quit(); 6 x( M6 M1 s$ X3 v2 B% ]
* n, e" b' s# u( r0 ~2 j
$ ]2 x/ v( O1 B1 vfunction RemoteControl_SimulationFinished() 8 j8 r1 j; T2 T' @+ h. p
{ / |. s+ c, A# b+ J
WScript.Echo("Simulation Finished!"); |