Example of a JScript 0 W# s0 S5 D; {: a
var vbOKCancel = 1; 7 P& P, A+ F2 P3 I1 L0 b
var vbCancel = 2; 4 C) `* G/ W% k+ _6 ?& e
var vbInformation = 64;
7 X( v5 r3 { S6 j! jvar Finished=false; / h) }, o! y) J7 a+ {
$ h& @* d: J+ Y/ X: _var WSHShell = new ActiveXObject("WScript.Shell"); + B0 e% D9 l! k/ A3 F
$ Y8 S. E7 X+ T$ n; G. _* `2 T O6 lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ ?( |- w+ S' N4 f2 V- [: X; Y; K 0 { I3 E1 R4 u
simple.SetLicenseType("Runtime"); * Z0 N0 ?5 t: l( ]" p$ {
+ D. Z2 f- |0 p/ s$ ` A+ c
try + D6 x- D) B/ m5 _% J# _
{
% Q! K( Y5 B* y( p // Enter the path to a model file!
5 w; P: W9 r* n. s3 c/ y simple.LoadModel("C:\\Models\\Test.spp"); 6 V6 u: B' f5 ]2 \/ `4 d
}
6 p! Y/ D$ _7 ]7 U5 Dcatch (e)
2 p' Z0 \! @- f7 z9 i! B{ 2 J R# n* }4 C: s" j( V: a3 g
WScript.Echo("Could not load Model!");
( k% l' P1 |' ~7 w4 C% Y WScript.Quit();
4 K+ r3 j% i+ w* [9 e* h} $ G0 X9 i/ z7 A3 F1 a* l& F
# Z7 e7 i7 q. T1 P
try
) O5 p! z' H0 q6 o0 I{
! Z4 T3 x% I' m# a' v0 o9 ~9 j8 {4 j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 _" w: g. s4 d* ^4 b) h+ s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) j# n: r/ A+ I' N
if (r == vbCancel) ) q5 \9 o7 z+ U8 j1 w- K6 G; p' o
{ 2 L/ i' R3 ^7 D$ b
simple.CloseModel(); , p% P% n( Q4 e/ I9 R
WScript.Quit();
3 Q. p! Y. T$ N- X W: f) D. Q$ D$ {. W } " p* J' Y, {/ A Y
}
, O. Y( u2 ?: ~0 V7 u7 L+ n, ~* k/ a5 Z
6 ~/ {2 ^/ x2 `1 d( }) Tsimple.StartSimulation(".Models.Frame.EventController"); % p8 \! y2 _+ a
4 O* }# [8 J! G- A8 Vif (simple.IsSimulationRunning()) ' i$ r- Q+ P" x$ ?
WScript.Echo("Simulation is running!");
: A, h# W: T2 b8 d ; x' d* D6 K3 E- D$ e4 {% N
// Wait until simulation is finished
2 B" M! R2 G8 t5 Z1 A7 O: z- uwhile (!Finished) WScript.Sleep(2000);
) |8 E! c/ R2 U' o( D' \
8 c$ \- I/ Z/ P" a9 J! [simple.CloseModel();
- c( L$ Y* ^: {. p5 L( q! vsimple.Quit(); ; V4 w4 I, H" S" S9 ?8 z l( j
WScript.Quit();
6 E: Q9 d Q& U4 ~) n, V7 C
0 G) \& E4 x; a6 w5 b7 u * C4 G9 I8 F+ w( \# d! @6 V. t
function RemoteControl_SimulationFinished()
* k* T& F" s! A" s) h{ % J7 q$ M( e4 V/ k3 t
WScript.Echo("Simulation Finished!"); |