Example of a JScript
: m) w* K I! N4 [& J. k2 Evar vbOKCancel = 1; ) u4 `& l. H" h& w6 S2 k- Y- I7 [
var vbCancel = 2; 8 { [0 s' C3 X1 S$ q" R/ ?+ f
var vbInformation = 64; 5 [) s- b5 p9 |' z1 W
var Finished=false;
* c0 o% P7 `! }- o1 X) Q. d1 w 9 j' e; x9 F5 R
var WSHShell = new ActiveXObject("WScript.Shell"); 9 H7 b. v+ r: k" l
$ |+ h# D' D* n: {4 r& }3 v1 p% s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: ^( e+ B5 q6 h ' w$ A) S5 ]1 l! |8 |( _. N2 V
simple.SetLicenseType("Runtime"); ' Y7 @2 a3 D7 F6 |, Z" ?( |
4 [+ c5 b' a9 p: [try : x. @. i% I5 j5 c$ Q5 ]
{
1 P7 m8 i' W) N% j // Enter the path to a model file! 7 q) x8 L k/ ?/ h2 L( u" ]
simple.LoadModel("C:\\Models\\Test.spp");
( z4 l6 u. k1 u, t5 I} & c# i; a( Y+ }$ d% ~, P* r1 W
catch (e) 3 z' |6 ^4 e$ q
{
, d# y7 j8 q( Z; q+ A0 m WScript.Echo("Could not load Model!");
7 ^9 u4 i1 p$ R0 S% Z7 {7 i# w& L WScript.Quit(); ' H+ p2 I/ C5 V4 Q8 k( O: Q
} 5 e8 P0 ?% L, O( s
* h3 Y5 [: q. Y* j
try $ A! @# _& _$ A+ }% Z
{ / L" R) _% [' |' S2 S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 k: T1 n' S6 Q! R7 q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 u5 U: z, V; s* b& u! g* M, Q if (r == vbCancel)
# F" W- a( Q+ o {
7 s5 K. U9 f+ | ?$ e+ j simple.CloseModel(); 6 P; }$ u: O: x) _+ a; F3 a
WScript.Quit(); 0 [) h/ o/ D5 ~8 U; P1 }
} ) ^. B7 |4 G) w7 D+ r& X9 k2 R$ A+ @
}
- A+ h7 [& i& W# ^
" z4 S" u5 t2 `0 v: i: @simple.StartSimulation(".Models.Frame.EventController"); 5 ?! h1 v7 J% D4 k! v
3 {+ Z! U/ b+ D' D6 V M/ I, f' d' y1 Nif (simple.IsSimulationRunning())
+ \% V$ L* m! o J+ i) m WScript.Echo("Simulation is running!");
4 [9 P, n2 k _1 c
1 X% ^% ^7 M* b// Wait until simulation is finished
0 w" ^7 Y. B% `2 R7 h/ Pwhile (!Finished) WScript.Sleep(2000); 7 p- k' V4 M8 `+ l
( S& q" j2 ^; h# Y* v8 T
simple.CloseModel(); # R- r4 w3 e. k
simple.Quit();
2 B! l, x7 B( \3 K. e- |8 ZWScript.Quit(); : L! U2 u, C0 e% u9 B2 b% f! w
6 A6 O( j/ [: `' }1 g% g% C
! G" h( v# s7 n/ E1 l: Sfunction RemoteControl_SimulationFinished()
) {1 ]; s4 L, e{ , B2 f! Y( x. j% u* R: A/ `) W
WScript.Echo("Simulation Finished!"); |