Example of a JScript " S8 V" S1 \& Y' ]- W! M
var vbOKCancel = 1;
. P" U1 C% O) r) B( \var vbCancel = 2; : _; W; x' {6 Y, k7 o
var vbInformation = 64;
: u) o2 ^8 v9 E9 L" ?var Finished=false;
& Q6 n; z4 f2 y W% L 6 p/ X9 U4 Q2 M2 N6 g
var WSHShell = new ActiveXObject("WScript.Shell"); ' z) o- f$ @: I) }7 N3 ?
2 F3 d; c! M/ I/ t4 b5 B. m: |! A4 W( E2 Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! p8 [1 A. p$ V0 |
$ J7 d) A4 [8 w0 q( fsimple.SetLicenseType("Runtime");
1 s3 M" D8 O4 a% W2 e. q 9 Z" ~/ \, s0 ^) D0 Z5 [
try - G: Y) }$ V# c( W# @9 C! T( t
{ ! a. G1 o. b8 `, R0 w
// Enter the path to a model file!
, @3 `9 Y5 F- U; n simple.LoadModel("C:\\Models\\Test.spp"); 2 u3 \& B$ S/ c9 G/ E/ A R
} 4 x$ j! W% a6 I4 ]/ i
catch (e)
. i$ p- i, ~0 ?2 w$ ~% d{
}# x; P; i- p3 ]1 @ WScript.Echo("Could not load Model!");
/ H% R2 {; x" ~ WScript.Quit(); 9 ]1 E5 |& K) ]1 p- ]" m
}
7 h, I3 W0 c$ k- C1 D0 k" ~
9 D. j& t% D+ ~, J. {try ' K7 f+ D! d& ?: r9 ?
{ / R+ s8 V# M9 Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / h4 {8 S7 N/ M& B' X5 p! A5 k4 P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( m/ T n' b7 C: Y' W
if (r == vbCancel) 4 R( {5 Z6 {4 T9 I
{ 4 x! ^4 ?5 i! C1 ]. e0 B, e( m- T
simple.CloseModel(); ' n8 P* R& m( g" {- ?6 X$ J& F
WScript.Quit(); # {! V1 i6 ]! e+ M
} . j2 z' L: x" ~) [
} ; L8 ]" a2 T/ |4 c) d/ C4 L
1 w5 I3 V0 C; y1 z! b. K7 \: dsimple.StartSimulation(".Models.Frame.EventController");
" m/ F) e# _; h4 b
+ }& H. e. H( t' T* v7 k, cif (simple.IsSimulationRunning()) % M/ x0 w3 }0 I q! m1 [8 Z
WScript.Echo("Simulation is running!");
% _8 Q0 o! L' @ # ?5 O7 h" L( d1 n( y( U
// Wait until simulation is finished
0 f3 c# D, q6 I* u7 qwhile (!Finished) WScript.Sleep(2000); $ C# I) Q, m1 T* a- `
5 w& M5 V' _& L) R8 i
simple.CloseModel(); 1 N# p* ]6 v# A4 y) D
simple.Quit(); + k$ R/ U$ H' X
WScript.Quit(); ) P0 I, M. ]$ P/ a; m( ]
/ e7 g) m# W! g; x7 o
1 j& g5 Z: g8 Bfunction RemoteControl_SimulationFinished()
9 @% n: D; m7 j" Q7 |( U{
1 S# o9 g$ I3 {5 k3 E( |6 a WScript.Echo("Simulation Finished!"); |