Example of a JScript
# [0 y/ q2 l+ Q, N% @var vbOKCancel = 1;
- G' X, R j9 S! d4 yvar vbCancel = 2; 6 l7 ~2 M/ b& `- K8 R# s6 d: @
var vbInformation = 64;
! R3 u; M0 U0 h8 }' @6 k( @var Finished=false;
! E8 s, l7 s" f1 \, \- w6 v
9 S3 s2 H5 D, ^, O2 Q; Zvar WSHShell = new ActiveXObject("WScript.Shell");
4 C6 c" _& ^( m, m1 t; Y% ?/ s 5 N4 R" j `/ p$ W8 U. x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% o5 Q R$ n& Y) j- x 2 J7 E9 f" R, \# { s& M* R+ T' c
simple.SetLicenseType("Runtime");
+ Z' g k, D* }5 U6 ?6 e7 R( ]
" s2 X$ ]4 @( y6 H+ Rtry
# p) _# t& \, i) Q{
' Y" k/ v+ q, q4 D // Enter the path to a model file! & c) ~' @* T% \5 ^/ P' ~
simple.LoadModel("C:\\Models\\Test.spp");
( p% a6 O. ^) Y} ! K4 P4 r' A# H0 v; D/ \1 K
catch (e) ! a+ N( w' f% y
{ $ }( ]. K: N3 s8 e6 b7 |3 z& X- @
WScript.Echo("Could not load Model!");
1 B+ D5 E3 a/ r2 a3 S% l WScript.Quit();
' i9 O- s! U% Z$ H, z} 2 E* O- ^- g& R( K0 O3 E2 G
' f' k9 o& K' V: Q; u$ Z# y7 r
try 5 E4 m1 c( k2 v) z+ z: \
{ " a; C# ~: E8 ]( `' m/ [- a
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( s3 ?" x# |% V! q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! E/ ~; j. E K# ` m: S
if (r == vbCancel)
& B6 G7 Y1 u! }8 h* A" r6 r7 X { * J) c* D6 D1 Q
simple.CloseModel(); 0 t" @$ z/ \; ?& d
WScript.Quit();
! b9 c, C( ?) o0 P( A }
# O0 P2 y$ M3 q# M}
^( {7 X2 i6 V* P
% }3 Y% u3 {0 N, ?4 ssimple.StartSimulation(".Models.Frame.EventController"); 6 a2 D; Z$ J0 E3 ^/ U7 H% f$ o
# Y5 B* X5 W% ^5 u
if (simple.IsSimulationRunning()) 1 F5 k! ~7 P4 V& ?$ o5 |: L
WScript.Echo("Simulation is running!");
' N, f! [& M6 K4 M8 W+ M1 ?4 C9 Z * W) v+ K& [. b, [! E" L
// Wait until simulation is finished ! N9 h/ T; W! d5 a1 K
while (!Finished) WScript.Sleep(2000);
8 @7 n+ z! h2 e A. {$ ^
, s; n6 s( k# \- ?simple.CloseModel();
* v5 `' t9 V1 g& e+ v6 {- B; xsimple.Quit(); 3 t" x$ {+ g( J2 M
WScript.Quit();
$ }$ K1 `+ b9 H# S g8 l8 G y
. y! C+ }* S( o. b2 _+ ?3 S$ j : N6 l; o9 Q+ v$ S
function RemoteControl_SimulationFinished()
! G5 b( b# `) P, y" q9 v# w{
. h6 D, e3 E! U& J% K WScript.Echo("Simulation Finished!"); |