Example of a JScript - x1 |7 X8 b6 B% ?/ J: N# n
var vbOKCancel = 1;
9 y1 w( X* K5 u. @- F# ^var vbCancel = 2; ; t7 i$ c, j! z$ T5 Q
var vbInformation = 64; 2 p( l& g4 F9 q) d: r! B- }
var Finished=false;
& Q$ S) H! n3 I; g# x1 i 8 Z+ Q/ d# S- W& }
var WSHShell = new ActiveXObject("WScript.Shell");
$ o3 Q5 a2 x2 D5 t. \ & y8 G. _, P, X4 ?& n( ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ h) L; M& U# L * c" Q& H* b1 P0 J
simple.SetLicenseType("Runtime"); 1 C6 o- j; f7 c, m
! ~1 R2 v( j c, i- U7 P" e
try
, d2 ]$ u) Q8 [% W2 H7 J{
6 k0 b; y' V# ?4 M- e' ]. F7 { // Enter the path to a model file!
8 c# H# l) D- t, Y3 n simple.LoadModel("C:\\Models\\Test.spp");
+ i8 @2 E2 w4 s( L, x' Q}
* A6 ?, K+ X2 e# K! k' k0 O) tcatch (e)
- l& c" k( ^$ Q3 ]4 n3 L{
8 `8 Y$ T/ ]: L3 h WScript.Echo("Could not load Model!"); - ]6 [! k6 L5 c
WScript.Quit();
$ }: Y7 n V3 J p) ~}
# U5 i" i! E6 g: A C, {/ N2 x
- n0 r$ C6 n" B# I. [try
3 C" D1 t) c( n0 A3 A& z* R{ & v6 k+ V5 q% a+ i U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { W0 \) U* k' t) y3 g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 B1 b' S/ m0 s) M if (r == vbCancel)
- g% y5 o/ p b- `2 ]8 G+ a {
. H! ~3 V ~& w+ z- R simple.CloseModel();
: Y, M2 h- x* [& N, c: { WScript.Quit(); ; E( o/ O- T8 S0 M1 w
} - _6 Y* S) P6 l+ L ^ X; @
}
- C& O x( q. L# j8 p4 l- y ! J' I% x0 a' x, L- A. ^ P
simple.StartSimulation(".Models.Frame.EventController");
4 E" w0 a$ G5 U: n
6 t1 r2 Z! _% D! p# \0 {' r2 rif (simple.IsSimulationRunning()) ^( G: }/ G7 C2 X( ?5 D* i
WScript.Echo("Simulation is running!");
! H) d& E1 C+ Q; w" Z; _
}( O: V, A$ ]9 |# B// Wait until simulation is finished
3 A( A! A- p2 o1 B, Wwhile (!Finished) WScript.Sleep(2000); ) @6 q$ d3 I+ C5 B+ H# n
0 I- R& N( ]5 Z8 [. U) Dsimple.CloseModel();
. [1 S" l. U2 A) a9 m& _simple.Quit();
+ Z2 |8 t" K/ s: [! h& UWScript.Quit();
( ~4 B% D, `6 B0 {6 y8 F
, R ]2 I( Y3 p& [4 \- Q. j
/ M. a) x' p) K) B8 [+ c+ x; Ufunction RemoteControl_SimulationFinished()
7 A: H5 |9 b0 f. i4 u{ 7 W$ u6 H6 i0 _, }0 O0 }7 C
WScript.Echo("Simulation Finished!"); |