Example of a JScript - Y! v* g) _: `/ u
var vbOKCancel = 1;
5 H$ f; P) ]' E6 `& Gvar vbCancel = 2;
9 E& M+ f3 h) ?6 O! u( xvar vbInformation = 64;
( [/ J0 |4 C C* w5 h+ ^: e" U7 gvar Finished=false; ! m. K" e2 F7 M0 \- J h
& [( ?3 I, F4 A8 b2 U' Hvar WSHShell = new ActiveXObject("WScript.Shell"); 9 h: y0 Z% c" v- L X
' `& f9 L& H+ n% Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # [) t* Y5 V0 _, b; d
. r3 `6 R8 R9 W; U4 J$ esimple.SetLicenseType("Runtime"); 6 @+ T, Z8 }3 ]& H2 [5 V
) T0 j* n( o0 V' ^8 V) n
try
0 L8 f9 S; I! s! s. Y- X{
7 s, c$ N" D% Z+ F4 Z3 c // Enter the path to a model file!
5 d, m) g, l9 V" w* f simple.LoadModel("C:\\Models\\Test.spp");
2 H, C, h4 t9 k}
& `% T$ t0 e U1 A) t% w- @& q; dcatch (e) q0 Z$ J) Z% K6 u4 |" ^! G. T
{
+ _4 k, |( l) N WScript.Echo("Could not load Model!"); 5 C7 k4 L P+ X( @& h% H
WScript.Quit();
: F6 x- |8 x+ n, @1 x5 H! T2 _} / C" z- o9 g4 {2 z. c" |. s" _2 @7 p; n
4 L% {: l! ]8 R$ q& @try W% _( w% {- {
{ " a9 i" ]2 }: h t9 ~; b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ S( e5 P# k0 p$ U- t* P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; B8 A- F, q- w/ N& B+ j6 C
if (r == vbCancel)
' P4 n0 s! a/ T7 Z. O {
# W0 O& j. A1 [6 C- J2 E simple.CloseModel(); ' b# g3 ?) u: @
WScript.Quit();
3 ^' \7 b7 v! Z% Q4 S8 [1 p: T/ U }
, A) U5 {3 c; L}
' d9 m: v0 H, J" M" F7 C8 R
8 p1 L9 V9 \' i! @( |simple.StartSimulation(".Models.Frame.EventController"); / c8 E: J' [8 d* j2 @
% S6 n: W2 T. n4 {2 Y4 `: E
if (simple.IsSimulationRunning()) 8 O7 u( o2 {6 n! l. t
WScript.Echo("Simulation is running!");
2 \% w! n% J" ~) ?7 [ |
9 Y3 u, b* J$ d// Wait until simulation is finished . Q0 Q4 G# w- k7 |: R: [
while (!Finished) WScript.Sleep(2000); + N" I; k* R- y6 N% F; W
/ X4 x$ F7 g, v0 \: q. Vsimple.CloseModel(); 1 F0 s: T5 @$ e2 j( C
simple.Quit(); 3 F+ O. r8 f Y4 [' J
WScript.Quit();
2 Q, K! i b4 W8 \3 f c n) i8 G! o. r$ D% w
5 `1 F* D6 ~" O. i3 s( l, {, c; ifunction RemoteControl_SimulationFinished()
6 @2 W% G& a, W6 s4 ^, e{ * M0 ~& Z/ f Q7 f% Y0 I0 j
WScript.Echo("Simulation Finished!"); |