Example of a JScript
7 ^6 O3 Y; W& X& z( evar vbOKCancel = 1;
4 s- F- l3 o5 c9 V5 y' i* rvar vbCancel = 2;
8 z: t9 r1 Z# F9 }6 nvar vbInformation = 64; + E ?5 @7 g- l; Z, c* O
var Finished=false;
5 X/ w; U2 y* ~* V 0 S* P6 b) f1 E3 L8 h- p
var WSHShell = new ActiveXObject("WScript.Shell"); : J0 E2 P ^/ W9 V1 _
" Q; O, d' L0 \3 Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 z4 @" f6 ]2 u F' w
B$ M7 {4 Q7 r0 f% i6 X% H8 \2 w
simple.SetLicenseType("Runtime"); 5 Y: n6 G0 Y1 M9 u0 A
( I$ R0 \ m2 S9 i$ M
try , F( y3 u1 \( R7 ?0 Y+ E
{
4 ^2 ]1 c" u! I2 K( {) n // Enter the path to a model file! + F' d& v& _) G( {3 C
simple.LoadModel("C:\\Models\\Test.spp");
( V( X* P' T, A" P8 c. Y}
" m# ?$ l% P% \catch (e) . x+ s7 h, c: j5 ]
{
5 S' v8 H2 }7 r" N8 b WScript.Echo("Could not load Model!"); , y0 [+ @9 v; H j& W
WScript.Quit(); ) G: i( y4 N* \' R; y9 D6 o
} 1 l$ F& l- B) M5 K9 {- q- h/ E0 ]! E
0 _ ~& z' A3 y3 stry * q) u" H2 n8 |7 n5 l& t2 v8 c
{
* |. d+ f9 V; z- I) y1 T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- N' ~3 q+ J1 Y. W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); i( h1 a6 r8 [# `
if (r == vbCancel) ) _7 [- ~; T7 i' |" P h
{
$ j. x% x, V9 Z simple.CloseModel(); 9 |) ^$ P6 n* S J' |5 Y
WScript.Quit();
- |* a9 Y4 f. n0 Z: x+ q } 9 c& Z7 v8 y$ y l7 C
}
3 b$ H* E6 A; S5 V; o$ s2 x! j 7 s" ^$ T; p/ v. p2 G" p4 J2 i: I
simple.StartSimulation(".Models.Frame.EventController"); 9 I# z n' i' Q$ Q6 j5 i8 f
& O7 b9 Y+ e- S& T$ ]) I# Q! V9 B
if (simple.IsSimulationRunning())
) Z/ G- i. l2 S1 o; p WScript.Echo("Simulation is running!");
, X3 E: s0 Z Z" J/ H3 L + z* B- r9 @5 T) `4 O" |( H. }0 z
// Wait until simulation is finished
9 t- h, t: s8 R" e2 n9 q; Fwhile (!Finished) WScript.Sleep(2000); 5 K. [$ g7 Z5 S7 h* k
0 k" t' I1 W) A- X% F. b6 V
simple.CloseModel();
: E3 [7 G( k! a% w) W7 _( zsimple.Quit();
/ G9 u v7 t* P# v/ NWScript.Quit();
- H; r1 V5 j- J( @" P
: D) M) s' |- W( T& a- i; `: x 5 u Z$ J5 k+ m$ `1 b7 ]
function RemoteControl_SimulationFinished() 1 p8 g% U0 m$ W
{
# Y1 F6 E p* B2 p! S4 F WScript.Echo("Simulation Finished!"); |