Example of a JScript
. V8 `+ U: k" n; [1 P! K) \( z. t4 u! Qvar vbOKCancel = 1; ) C$ @ d% m9 T7 j
var vbCancel = 2; " V1 Z G6 h) z, }& i( G
var vbInformation = 64; $ M! ~+ Q. [3 N
var Finished=false; . J( z2 ]) o4 k/ D* V! }. U
6 L" j7 L+ {- o7 zvar WSHShell = new ActiveXObject("WScript.Shell");
& a3 T- U( ?" d# c* `) y ' d: g) L2 Z* U5 y& b/ { G2 d( n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , f- v$ q& r6 n& o) w, |9 V1 p: q
1 r4 Q+ g! j. F3 W: P& O+ ysimple.SetLicenseType("Runtime");
' ?8 g" l: Z2 V, w# K1 Q
R) G0 [. P% K8 \6 f! qtry + l$ y# U' X' d* l% G
{
" D$ c; _" w4 m! l5 w' {6 S2 s // Enter the path to a model file! 2 Y* k k1 V2 {% |5 W) u% W2 f/ r
simple.LoadModel("C:\\Models\\Test.spp");
7 g/ @! j3 P& I! ~0 Q0 U}
3 b+ T3 ~- R3 I4 M1 f5 j3 E3 Dcatch (e)
* _9 [/ p4 ? ^6 L# D9 U# q8 |{
% e/ W/ p) b+ V WScript.Echo("Could not load Model!");
9 \& Y& h" m' [; z9 y WScript.Quit();
" W& |) v8 M* ]# v Q8 X} ' M" K" @' D/ ?! t" i( n' N% d
. h" w5 w3 V5 _4 U' B! \' ^
try " g$ P8 z: z$ @, q/ Y
{ 3 O8 ~, i! o0 K, F2 O% x: i i; k
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! t: x$ }' y# E( ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" t4 s: q5 b! k3 o if (r == vbCancel)
8 E7 l# B- T! Q f {
1 K" z" v+ {* p* ?7 J0 H& i simple.CloseModel();
. y4 \$ d6 s, c1 h WScript.Quit();
+ L9 v& o w0 M- y: j0 Z5 b } - P5 A" D, C" t" C! I9 Z" y0 }
}
9 C7 W% q" `" `
7 t+ m+ S- h% y0 A; N0 `) F W" jsimple.StartSimulation(".Models.Frame.EventController"); 9 |3 Q1 J$ W# I/ A* L* R( f4 l4 j
4 w! L% W! G7 z+ m( eif (simple.IsSimulationRunning()) 0 |# Z3 w6 d: e, k u: B' S1 @
WScript.Echo("Simulation is running!");
. }: E- q+ l' S+ ]! t" F & q+ ?8 `1 U- ?4 [2 r; B. y2 z
// Wait until simulation is finished 1 R6 h& W$ b* U l0 [ d
while (!Finished) WScript.Sleep(2000); 2 }: {: f5 Z5 k& o# J# n
* h, M: i4 J9 [' G, f# O# Nsimple.CloseModel();
# H3 G: |( }9 f5 K! ~: L& p; v( I6 } ssimple.Quit();
3 S8 m. o$ Z. W, YWScript.Quit(); , }& S$ k4 o/ x
% `/ R0 W# ?: J/ a U
5 m0 `1 G: J: h2 w
function RemoteControl_SimulationFinished()
+ J5 a8 a) \% F0 e{
) L$ y: ^; A8 R, W/ t WScript.Echo("Simulation Finished!"); |