Example of a JScript
* Q( R& y8 `$ w) T" P% J- f) Evar vbOKCancel = 1;
) l1 q }- f8 T# ^2 N/ u1 I @* M6 y: i. fvar vbCancel = 2; 0 v' R$ R5 B) C$ s# j' m
var vbInformation = 64;
, ^3 t% h, d& m% Y Q8 c8 svar Finished=false; & ~: z% H1 m& G: ]; B: _* E
9 R$ ~) j7 r5 x- D& g0 e
var WSHShell = new ActiveXObject("WScript.Shell"); 4 G6 u% ?" y8 }% T( n
' l/ H6 t* ^+ v% O) I; T( yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / C! u1 A% J4 g+ h6 _; e! \' o
5 {5 C7 v1 T2 |, E) ksimple.SetLicenseType("Runtime");
1 _" G! |, B8 c7 o) z* l
/ s/ ^6 R9 G* l) }try 1 z( f* C. x- n" o
{ Q: J- x& r: M. u9 H
// Enter the path to a model file!
: | ]( x# _" D8 V% y. B" G simple.LoadModel("C:\\Models\\Test.spp");
" A) t, {& D- m! g; p}
6 q4 U0 A2 n( a6 A: }) Ycatch (e) / g% p U8 m+ j6 B7 ~
{
- H5 I4 y1 z; E _* L, N( { WScript.Echo("Could not load Model!");
. N; I, P# \/ L WScript.Quit();
& f" f7 i# w; J" u5 t6 o4 Z} * @# u$ B% h/ h$ j+ S0 [
- g2 b5 `5 k( ?) b3 ntry
* ^, Z$ k2 j( x0 M8 e4 ]0 r6 |{
4 U+ a( ]/ {6 K! v9 f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 ~6 ?: W8 H. `3 j4 |; b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # p* Y2 J0 U5 X$ _; B5 H7 E
if (r == vbCancel) 9 `& _8 N" S% t! V
{
: O3 L q+ N( e9 b1 V- e simple.CloseModel(); # o9 j3 M& N: ]8 V# `8 m
WScript.Quit();
3 |* g% x- ]1 } ]/ R } ( m9 U. G! V0 M) y4 x$ U/ I3 [; z9 D
} - U* O: O% P3 ]$ `- E3 _- |$ K
/ l* N9 T- U* d7 P/ C; u3 Hsimple.StartSimulation(".Models.Frame.EventController");
* r4 p& n# @" P% a' D
& O2 S. ]# u+ n8 zif (simple.IsSimulationRunning())
2 U/ g5 f# X0 a5 p* j3 Y3 V WScript.Echo("Simulation is running!"); + ]: d9 h" \, p( ^+ w
4 \0 W8 M7 Z& N V' x @, L$ ]
// Wait until simulation is finished / Y9 n3 b2 O7 l; i+ L' J; T
while (!Finished) WScript.Sleep(2000); . {" F7 U5 K! B& n1 a
9 \. N8 _6 x; m6 H4 c, U
simple.CloseModel(); # e* H, d# c: y; p1 n9 }
simple.Quit();
# }, h2 [: k- uWScript.Quit();
) o; e0 ]) S0 F% v0 A) @! G& N
4 @3 G$ g0 e7 m4 w8 P ' J0 r: D: u- g6 ^
function RemoteControl_SimulationFinished() 3 K( U# q1 a+ |/ C: ?" m0 q' J N
{ 0 \. ^. _/ d0 ]
WScript.Echo("Simulation Finished!"); |