Example of a JScript
8 {: @$ ~9 o, C. z0 h; Q( Rvar vbOKCancel = 1; 4 h+ Z4 `& L" n1 Y7 \
var vbCancel = 2; 1 f0 N. j8 C! {/ y
var vbInformation = 64;
u2 y: o. @4 X5 `" h6 E/ yvar Finished=false;
5 o2 [5 s, m, e( q* e. O7 S' c
6 D0 B% m& Y- G1 d% V) Y5 F; Gvar WSHShell = new ActiveXObject("WScript.Shell");
' r5 m i' @! T: r$ z) z & V+ x+ \& U! d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ c! j& L" E# ]4 I3 k ) T( n9 I: R' a# U2 D/ r' `# Q5 u9 i
simple.SetLicenseType("Runtime"); , J" r; I2 Z* J. j) w' {
+ z/ t( b- o* k* j( Y# jtry * L; a, I' `+ t
{ 8 K; n% |5 G6 v# e: L6 R
// Enter the path to a model file! 4 \$ _, l+ K; k1 a4 x m+ d+ ^
simple.LoadModel("C:\\Models\\Test.spp");
/ Q* U; {6 g; I, M7 h}
/ l/ J' R5 x0 k8 c! L# Rcatch (e) ' u( o" u1 @" y5 }; b2 H# w
{
8 B. N4 k. `5 o" a7 f- x* H& S- T WScript.Echo("Could not load Model!"); $ Q/ G! I8 K0 u; H8 F) Q
WScript.Quit(); ; V% ^" e9 C$ c$ u( S' [' D
} / f! y' R( D& O. E
0 o$ c9 ~# X: T: ~2 `1 q
try
# l& k) _6 M C; K! p9 d: t{
8 X' e: i1 ^7 R* _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' d7 f- H5 [1 x; `6 x
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! z! h3 m5 x0 W" v if (r == vbCancel) " l4 h. ]9 o# F3 S
{ ( q: ~3 y* f4 [! n W9 O
simple.CloseModel();
5 U( V( B& B6 v5 y WScript.Quit();
$ ^. D% y( k/ z- C1 X! I } - {! Z4 {# p2 x4 t6 O4 G
}
: |7 `$ n) Z" c( X
9 v& Y4 P( M, h( e' f6 R/ |( ksimple.StartSimulation(".Models.Frame.EventController");
' s) w G% g( ~8 w; Q$ _
5 U# U9 B9 ~/ Q5 a% h7 t6 d# ?- t% Fif (simple.IsSimulationRunning()) 0 L" y; P+ o2 ]# y2 o9 V
WScript.Echo("Simulation is running!");
2 E3 C+ _7 v t4 O# j/ I
( w* H3 H. j2 j1 Q// Wait until simulation is finished 4 D3 m5 N, G: ?5 ~) Z
while (!Finished) WScript.Sleep(2000); 6 l8 N3 W D2 {- s8 u% n
, r5 i' _2 k* Q
simple.CloseModel(); b& b$ M* F0 Q7 M( ?
simple.Quit();
, r, q5 f+ W% MWScript.Quit(); " p" e7 q7 O+ m# n0 M" h7 Q7 x6 Z
* t( S2 y4 u: A9 p; S. B + Q( u$ | a; |: B6 [( `) f; P& p
function RemoteControl_SimulationFinished() 0 {. w# }, B2 A% V3 K9 d
{ " |, G, j% J: M4 P- `5 l2 Z
WScript.Echo("Simulation Finished!"); |