Example of a JScript 6 L& p# m/ j0 @" C, O l6 g K
var vbOKCancel = 1;
0 s( V6 }. Q& r4 N. y+ Ovar vbCancel = 2; 6 M5 X T' x+ }: g
var vbInformation = 64;
0 m7 N' l* c9 _" {4 S$ ivar Finished=false;
5 O9 z7 B$ K5 S
: N: G) j) R, uvar WSHShell = new ActiveXObject("WScript.Shell");
* h9 B; f, l7 |6 C* D" _0 t! o . P$ q4 y9 h+ B
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( J6 r5 l# o' _" h, @8 v
/ [( d, S* ~" W$ \: N# O; Z) m, Zsimple.SetLicenseType("Runtime");
5 E ]9 T9 m4 W3 W9 g
: B( H! Y# v& M9 J0 I$ V. `" f8 J& `try
5 d1 M& g' i; J% b{ # A- h# G* ]" d& p2 m8 B
// Enter the path to a model file! $ X: d2 f4 A9 _% Y, U( I5 C6 E2 d
simple.LoadModel("C:\\Models\\Test.spp"); N& u' r0 d2 L5 [) h% E
} % S( @" B% ]) F: Z+ T
catch (e) ! L \2 q! r+ D
{
. v! c! M4 T8 {. Z) e3 v WScript.Echo("Could not load Model!"); 3 p$ o- F5 n' p
WScript.Quit(); & @& ]7 G) r; h. d& \/ }
} : |* T/ p, z* l; F; X
, R4 y" ^/ ~* X* n- ^# e, @
try
% } x/ o* o5 [6 ?% ^7 _/ R{
+ b1 [4 w' g$ ^4 B% q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 v7 X8 u/ q2 J r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : t C' r ?, r7 r3 R$ K) `- |! ^
if (r == vbCancel) / w) l: x# i+ X4 x p# E6 o
{ O R/ s6 N" s. |1 S
simple.CloseModel();
6 Y+ `9 [4 m+ @ e% y2 z) P0 z7 q# s; i WScript.Quit(); * w+ H) q& ~; V9 C* ~
}
! b5 j: D2 i6 q; ~9 Y) Z/ X}
5 X+ r0 \+ t8 Q6 v$ X " ` d" V/ k# ^% R0 U. A+ U1 f
simple.StartSimulation(".Models.Frame.EventController"); 0 J+ _* a; i9 L7 u/ P; f+ X( @
6 J0 Z. B H4 n* N4 a0 A" D2 eif (simple.IsSimulationRunning())
# I$ w1 i: G9 s3 P I3 G U+ N2 y" x WScript.Echo("Simulation is running!"); 2 n( P+ Y1 N! F0 Y' k; T
* x' {# [4 }: Q8 H# |% Y// Wait until simulation is finished
4 W/ W& |; k2 F- m# t- u# Ewhile (!Finished) WScript.Sleep(2000);
0 o/ M; ]2 N) \1 W7 T6 U" y& @# V 5 c' h! G6 H# G$ R
simple.CloseModel();
% A: u& _; G; d, P8 j* Ksimple.Quit(); . P( y2 l5 O, ~: C' W/ [8 w
WScript.Quit(); 5 D3 G7 J- ]: p: [/ V2 t
' q6 a$ m* c6 H J5 H
% t; c- i& X5 z# \* O
function RemoteControl_SimulationFinished()
3 S9 ]/ O8 j" y/ \7 ~{ 2 f! ? B1 F: b5 Z5 a
WScript.Echo("Simulation Finished!"); |