Example of a JScript : }9 I0 ^* i- i
var vbOKCancel = 1;
, Z% `& F2 x& t$ A% `( rvar vbCancel = 2;
( Y' Y1 t7 ^ T2 j6 a5 O8 Hvar vbInformation = 64;
" M8 m" n+ _) S- ], qvar Finished=false; 8 U' Z+ H8 Z* C4 u
0 S4 d5 N8 y4 n& b/ ~* ^
var WSHShell = new ActiveXObject("WScript.Shell"); ! r. W2 _! t8 }8 P
0 ?/ k; n4 d! j3 [! P L5 Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( P6 l6 g6 Z) O- F; [/ {" W
" b0 X9 @% r# g" ]& n* X: U
simple.SetLicenseType("Runtime");
+ D# Y( s& }" \8 a% D I- K( k6 A# B5 j
try 5 p- |/ k* f4 m7 m" R; D* T# D
{
& g2 |" @6 ~3 Q9 w$ X // Enter the path to a model file!
$ ]0 N; ?0 s4 M simple.LoadModel("C:\\Models\\Test.spp"); 3 h1 H) o, s' N0 r% \
} 1 Y: ~- f# G; ~# ?7 t
catch (e)
v$ c+ ~! V5 q7 G5 z0 d7 \{
; j6 {9 u" Z; f WScript.Echo("Could not load Model!");
7 M7 r9 `( i1 ^3 B' n2 w WScript.Quit(); ( p5 ?. P) ~2 f& d* j ]# U3 ~
}
- {& b& V, L/ _1 | ) B. h/ x" A' n& l: X
try # V. `/ d3 X. O" D
{
! e) u7 Q: T4 ? simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 z7 P9 ~, @5 u" s2 v$ G r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 h. H1 C+ p+ c2 E$ _/ F& q: o( b if (r == vbCancel)
7 V6 n. M. Z9 W9 o; {4 a* s {
( J$ D+ p+ B A simple.CloseModel(); " D; V4 h6 K) ~3 Y7 X2 @6 f: r- R
WScript.Quit();
. C) {) g% D' A }
$ i& _, S+ m0 c2 O& Q! r0 Z}
5 `0 r# Q; l( V) w7 U5 M
7 ?9 [: A9 x8 X5 `$ t+ R! Z# R7 ?simple.StartSimulation(".Models.Frame.EventController"); 7 V$ p! t, R! o" g
+ z, b0 J% m2 m' \6 Z' x
if (simple.IsSimulationRunning()) 9 g" J) G+ S# ]: t
WScript.Echo("Simulation is running!");
& U- y3 G* @/ ]/ |) E- X 5 R* ]- t* D3 a* J
// Wait until simulation is finished / _: L* D! U4 u$ g& j6 R1 @
while (!Finished) WScript.Sleep(2000);
+ \ z c) O) Q3 i
* f l. x, i/ p% ^ N% ]simple.CloseModel(); 9 S2 v9 `8 w/ \: N! E5 L
simple.Quit();
: K$ q. ^8 j/ ~' j) u3 A; s: S+ L. X# [WScript.Quit();
6 c7 L7 H! i( S" b + k3 F' E- {/ f; U# `7 O. w4 r
$ B/ i1 d5 b$ I5 z. M
function RemoteControl_SimulationFinished() 1 t: q0 Q5 W2 k' [
{ ' O& X% V' e$ O, _ \5 t4 `
WScript.Echo("Simulation Finished!"); |