Example of a JScript
& D' ?) R3 H* S2 g0 O6 d+ a0 Evar vbOKCancel = 1; $ r, r6 L7 u, r3 e# Q+ ~" d
var vbCancel = 2; ; S3 L# O, }4 ~! V' u
var vbInformation = 64;
* E8 x% G+ ~6 R! B( |" Evar Finished=false;
! B* _- S0 W. Z `3 k
3 s% ^, T' L5 J/ H7 Wvar WSHShell = new ActiveXObject("WScript.Shell"); & L& j2 Q$ |3 \+ `( Y- N8 \
+ n: P8 h& C2 A) K/ V
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); j, }- I% @9 `# Q' E" Y4 a
; W; y0 @, N2 B/ Y2 s
simple.SetLicenseType("Runtime"); : F* B+ \* ]7 r3 s6 N
1 q/ z$ a% w, G
try
+ f& z. \" e+ K' D6 m& C1 a{ : d$ O w# W! L5 J" X
// Enter the path to a model file! - R9 ^) }' j) z3 W% l0 ]9 o
simple.LoadModel("C:\\Models\\Test.spp"); 8 t7 F: N/ @8 P% g2 A- p; [) [6 |8 E
}
7 I, T8 Y( v7 O% d- y/ f9 Ucatch (e)
" c3 j* }5 k" ~- j$ |) D8 ?{ 1 o8 d% s- ~; m3 v( S& \1 {3 U2 V
WScript.Echo("Could not load Model!");
. `: E* I9 e4 J1 \. A! e% d WScript.Quit();
/ s7 s/ c! e; ]2 J8 {} , O# |2 M. d0 q8 l% S+ @2 ^' \
) o' r7 l1 E3 v" s) U; ytry 5 ^8 G8 r+ w! g8 t
{ 5 G2 ?8 |9 Z7 W" K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : v, S% n8 u; x8 F5 @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) O( O1 R7 u' o5 o if (r == vbCancel) 8 }- d2 f; h3 G/ g6 Z) w
{ 4 z' A" M' W0 x8 h
simple.CloseModel(); " B& g. H6 X" w3 b
WScript.Quit();
7 @, g1 C3 P( l5 c# k } ! A ~+ @* @; W0 n1 O
}
/ [5 E/ f J% T: ? . k7 y2 r, ]# w" C8 l
simple.StartSimulation(".Models.Frame.EventController"); $ B! [* }# W: B2 ~" N
3 S, W7 @- S! O4 n) ^ C v0 R- Xif (simple.IsSimulationRunning()) : k- m) y" X+ `; |* H2 [
WScript.Echo("Simulation is running!"); & M% F2 ]1 C$ o, \4 J
! x1 B" R8 l# W) ]( h
// Wait until simulation is finished / i' j" \9 d0 O6 T# F
while (!Finished) WScript.Sleep(2000); * K& F9 M8 Y/ d5 k$ j" O6 x
4 W& P7 D& G( U+ k; ksimple.CloseModel(); / r, F3 [3 m' D: Z; ?
simple.Quit(); ' d+ N0 v( y& _2 ^! s( {
WScript.Quit();
8 n- @6 d9 n" D! ^2 N; s. e9 G - ~1 r5 U% o: Q) A3 F/ t: Z; w m. H
2 h2 J) a) U) P5 _( Ffunction RemoteControl_SimulationFinished()
; |- B6 @ @ K" @& j{
' N4 V9 p- V5 z2 g/ g Z9 j WScript.Echo("Simulation Finished!"); |