Example of a JScript " ]2 b: ^! E7 o" T$ S
var vbOKCancel = 1;
5 ^% r+ a; |" ^8 Q+ c% X% Avar vbCancel = 2;
9 R8 T* r) {+ {% z# ]var vbInformation = 64; 8 n7 J0 _0 }; v. f! N4 r
var Finished=false; - K2 i: u( @. e# q7 \& A* c7 g( \
' p4 n3 T: g* Ovar WSHShell = new ActiveXObject("WScript.Shell"); % p$ j3 \; J3 l V1 g( S
8 w+ B D9 w% T% g6 S' r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . e+ Z( U+ U( z! Y7 h; K
) N. ~; i. g j$ @ I9 v4 ysimple.SetLicenseType("Runtime"); * h. h8 @! G; f0 R& F
. c8 ^; Z6 X( S8 r
try
! p t2 \2 n2 H: F" b{
7 `7 D b9 Y3 ~6 H) B+ g5 [! p // Enter the path to a model file!
! z, f8 N5 h" |- R' k) z$ } simple.LoadModel("C:\\Models\\Test.spp"); ( j( `& l* N$ Y% F7 M* |+ _. H
} ; T8 S& j. B e1 B
catch (e)
: r5 H1 f% R% m2 j: t) K+ B{ 5 t4 l M# H# S$ I# p( ~
WScript.Echo("Could not load Model!");
+ k0 x3 Y i6 F9 W' h9 ?0 y WScript.Quit();
g; l; m7 Q. [/ ]3 H}
0 z- H* d3 a' J) F* v# s. f/ n
' P' d3 p$ K4 j; x utry
! l" M4 |% a f& [0 \{ ) H# r; i- Y- ?3 |, k: x" I8 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) @; J0 U& p; m1 f# a1 F! g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 ]! f6 P4 P& M8 E if (r == vbCancel) 4 I' K2 a! s1 V1 u
{
3 U* g0 c* Y8 f H' t; I O simple.CloseModel(); 8 `& y; t7 D; w
WScript.Quit(); . \: x3 V! H4 `+ s5 z/ H
} 3 l$ K3 s" {: Z# A& p8 U7 |, Q% V
}
5 P) j# U# {3 A) B. C0 W; M + f f' H3 i7 ]% f
simple.StartSimulation(".Models.Frame.EventController"); , }* G: T" F; Y2 }# j
1 X- e! [ X+ J' ^if (simple.IsSimulationRunning())
% Y( S- {$ g1 |+ l* N8 N0 e. | P f WScript.Echo("Simulation is running!"); ; D5 }- a: |% x
' }: |9 B8 s" Q) g7 Y// Wait until simulation is finished ) Q) L5 ?9 K; A7 M# u: V% a
while (!Finished) WScript.Sleep(2000);
g! P7 J) P, [; m
* Z, M) m5 W& `7 }simple.CloseModel(); 9 I& w/ V, l o
simple.Quit();
9 K! L9 }! S5 ~" \WScript.Quit(); : G% {3 V0 n9 t" D7 h; ~( [
) o% B$ Z# {+ h6 d# O
3 h! ]( y0 l& }: z9 ~: `& G; |& ~
function RemoteControl_SimulationFinished() 4 J: s- H% m( r2 C
{
" ~4 u; E8 P' j; i c8 i WScript.Echo("Simulation Finished!"); |