Example of a JScript
1 w }. h# [ y. @: dvar vbOKCancel = 1;
1 F# e. [( B! B" k i8 c' ]var vbCancel = 2;
1 n- d- [) K& }; ]( w7 uvar vbInformation = 64;
U, G5 H6 O, ~, ~% d( q6 Y4 Mvar Finished=false; - ]% d* Q8 ?6 Z, Z+ a5 x4 r
% L: r4 W6 h$ \4 W
var WSHShell = new ActiveXObject("WScript.Shell"); 0 U1 f& Y5 b4 V' a. z) L3 v
9 W+ P! t& Y) L0 w6 Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, ^3 C. \, d4 G, T m 8 `& ?, j) ]) y/ @
simple.SetLicenseType("Runtime");
; F" U5 T& t5 B3 T7 `: Z
4 B. V2 q& c) r0 a( ^$ rtry - R; n" m0 @9 C0 G# Z$ z
{ 1 d% X' h- C0 b5 y9 z/ W
// Enter the path to a model file! ' l+ F0 T2 q; ?$ i# @9 a2 a
simple.LoadModel("C:\\Models\\Test.spp");
! j/ [( ~+ ~' U9 @2 H" B} {2 t% f/ B( j. l
catch (e)
/ n5 z Y5 A( G# b, I$ f# H{ : \* V! w/ ~4 S
WScript.Echo("Could not load Model!"); 3 m* ?: j3 r# ?$ [
WScript.Quit(); ( W, p S1 E0 L J0 j3 S
} ' C [# X; z) l A. t r
) g5 i8 K6 L: G/ H0 n
try
6 J D5 o2 M& @1 Q& n* a{
8 h. s) A" T2 z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 r! G w: C$ r+ E. t
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # h+ r; f5 L1 |" e% ?' `4 `
if (r == vbCancel) ! z V k/ G# A+ x4 ?9 T( y2 J
{
: W, [7 ]! j; F+ E" |# i simple.CloseModel(); , z- D/ m @8 F d; [, z
WScript.Quit();
2 j' B3 x# h8 r' s6 k6 [ }
6 \& ~; Q6 J2 i0 ?$ @) s}
+ L, Y/ j, Z) U) U! m; ?* G
) R8 [/ U, [9 B6 dsimple.StartSimulation(".Models.Frame.EventController");
7 w9 u) e* F$ s: x9 ~0 ]# U
6 M6 `& `: I) m' ?( w, `' x4 [if (simple.IsSimulationRunning())
+ i* B$ R* J" G WScript.Echo("Simulation is running!");
' e. \+ S F& t 7 ]7 M+ R8 I' m* u
// Wait until simulation is finished " M" `5 b& Y& C4 Z# T k
while (!Finished) WScript.Sleep(2000);
# m4 F8 g2 Z. m$ p. w' f; [# Q6 F
" k; } Y- D$ C& q% p$ T( Z& \: Q% ]2 ?simple.CloseModel();
* q6 R* G" a: |& G% X) a0 Bsimple.Quit();
6 B, k: D# A a; \; t& \3 zWScript.Quit(); 0 Z) |0 x% N7 |+ h: [3 w, x
( c' e0 [5 w6 _% r9 O
+ N/ `3 X& S' g+ U* K0 `; ` t {function RemoteControl_SimulationFinished() - }! V0 s1 l0 R& R1 I' W1 I
{ : b7 j! s6 V% r' Y g, J& `/ q7 @7 s0 o
WScript.Echo("Simulation Finished!"); |