Example of a JScript
( V4 G/ h0 `0 f9 S, Mvar vbOKCancel = 1; * B% q/ w+ b! @ e4 y9 T
var vbCancel = 2; Z. w# G8 p% x; H
var vbInformation = 64;
; S1 a; H( r9 M, jvar Finished=false; 0 ^) M) S: k3 b' H
8 R8 r7 ~. {# T6 N! V9 k1 n
var WSHShell = new ActiveXObject("WScript.Shell");
5 }7 o6 `9 A- m" @! t! g# ^" n
s& t- ^ I% a; P- B* d7 ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" C& B+ \4 g) K! b+ D- ^& ` 7 g6 M4 n0 F) l
simple.SetLicenseType("Runtime");
h7 f _& X- E8 `
1 K' ?. F6 \% D6 R7 Ntry
* @. N. s" E' a7 z$ X0 O" @ l2 ^{
6 J( A2 ], [) u, _. t // Enter the path to a model file! + p4 f8 _; Q7 v: C+ T
simple.LoadModel("C:\\Models\\Test.spp");
6 I G9 z& s+ q1 ~4 R# j} " E; `9 ~5 w: H! S, L, g
catch (e) / B7 c( y1 H3 Z( Z/ c8 a5 c
{
, k* S ?8 ?2 ~, w' I; G! I. ? WScript.Echo("Could not load Model!"); & s# m2 l8 m, ~6 ^. [. R
WScript.Quit();
& J$ W: L) v- N. d+ j! x}
8 |) y3 n' o1 q4 T$ G ^, A" z+ n8 p7 ~
try 0 e2 y3 |/ a6 o5 M( p O/ d3 ?
{
% Z: b# O* `2 L; U1 Z j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 W. N. Q: `" ]' J r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 U" W( |+ `! S* u g+ c# d' Y if (r == vbCancel) 3 s* N/ i8 U; M' j. f" u/ f/ i
{
3 u2 }" O! W7 J4 t7 g6 n" F/ g- L8 I simple.CloseModel(); 5 Z! n2 j: u+ N8 y: f
WScript.Quit();
' z* c' Q. E! c" v* X& P9 V8 U. _ }
3 I! F7 K: t4 D& P1 F6 [$ Y- e, q}
% i6 A# h/ F% \+ \) |* V. q1 n: e
8 h. q& p9 k8 Nsimple.StartSimulation(".Models.Frame.EventController"); 5 o. s B! _5 S, }! z
3 f: S% H8 L I$ A3 P% O/ g
if (simple.IsSimulationRunning())
1 J* c3 m1 W" R6 W/ y WScript.Echo("Simulation is running!");
g8 S; t2 D' e i* k. p) o1 K# @8 X5 m
( ] ]! |: y0 g# N4 F$ J" S8 e// Wait until simulation is finished % {$ N& L- K# v2 G0 {' Y- I+ k
while (!Finished) WScript.Sleep(2000);
# m f" e$ s* W
( a7 {: E' ]& {! J. J- |- ]* d# G7 |simple.CloseModel(); ) t1 l6 C9 _9 b! e/ |
simple.Quit();
4 n) d$ M' v- p5 o4 O1 aWScript.Quit();
, N0 H# L% c K2 ~ + o8 Q% e, D/ w+ c: T
: j+ s0 ~: p/ C. Q3 V0 J/ @7 }/ Bfunction RemoteControl_SimulationFinished() & X U! g; q) x2 W+ F' |
{ ! l% o) @4 P" X1 M3 n- [* H" l; f
WScript.Echo("Simulation Finished!"); |