Example of a JScript " ~/ O7 u5 E6 A! J" _6 x
var vbOKCancel = 1; + u1 a. i+ |$ D2 I
var vbCancel = 2;
+ `0 ^$ {( @- Y+ @0 nvar vbInformation = 64; 2 M) H' w4 H y3 k6 @
var Finished=false;
7 G$ X; p9 Q4 r' z
: I" ?. _& k" H. C3 yvar WSHShell = new ActiveXObject("WScript.Shell"); 2 W5 B0 V$ y0 `% H$ Q0 f' H
4 L X+ [7 \. \: s I; `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * G9 c* b% Q |$ ]) p- q
+ a1 H8 m0 t5 L- m, S
simple.SetLicenseType("Runtime");
: s+ y. Y8 X; Q 6 ^) ]% o+ x0 p6 y
try
" o4 ?( R: k9 z& y C{
K7 g- N" N- M // Enter the path to a model file!
' h4 @; F' t# Q+ T simple.LoadModel("C:\\Models\\Test.spp");
2 k" M5 O4 F% p1 t2 P7 N}
1 d; U8 x5 @$ w+ n* y' bcatch (e)
+ g. T* ^% [% V, W |{ * G; [) Y) ~. @( U2 n# y( m
WScript.Echo("Could not load Model!");
9 e1 Z% H: L: g9 q0 y) X WScript.Quit(); $ S- y- A' m* I" }) |. R
} , `5 D; j, E3 H$ q
$ ?+ R4 C7 j* itry 8 ^6 E4 m$ W; c" v) `% }
{ 9 V! `4 ]! ~3 @8 t5 J4 O2 B3 C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 @- H- I8 z6 S: `1 D/ C9 C1 } r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! _& z. _2 P: b5 ~) [ if (r == vbCancel) 7 P' t& z2 J* A$ S
{
0 `1 _1 w4 J% e1 B: W simple.CloseModel();
) i- d+ C1 I% d' c5 M$ y# X9 I" D" w WScript.Quit(); & b7 T( }$ v" U4 n# ^" `2 {
} ; S: A m) S/ P2 U0 W/ x
} ( Q7 z! S* K& n
0 B" _" r" W; Q5 ^: P: v0 u
simple.StartSimulation(".Models.Frame.EventController");
* T9 u- b; c- T . f4 `# n" L$ Q1 b4 y
if (simple.IsSimulationRunning()) - u( w; L6 l$ x+ t* I% @0 |
WScript.Echo("Simulation is running!");
. W3 B9 S& V' e0 w2 i " J) h; I; c" O1 b
// Wait until simulation is finished * i3 T0 ^0 m$ h- u) |
while (!Finished) WScript.Sleep(2000); * ?" b( X+ J7 _0 ~' f- o, ?: I$ b
2 `: ?. o- ~% t! d/ g9 S1 r
simple.CloseModel(); 3 B8 D4 f* G5 @% E1 c) L6 ?
simple.Quit(); b V4 M$ W" H- I& m5 `
WScript.Quit(); ' @) b1 r$ j- e7 U
" X6 P8 ?. N1 P, a5 y 5 E* ~0 u Z: ~7 i! }
function RemoteControl_SimulationFinished() , |. H$ @ `: }3 ]+ o
{ $ u3 J5 ^# _: ^$ Z% W
WScript.Echo("Simulation Finished!"); |