Example of a JScript
: |7 {2 i" Y, Q9 P4 [9 G. o4 jvar vbOKCancel = 1;
* K5 P' a5 X" E; t0 @5 ~" D- f: Yvar vbCancel = 2; - Q% h: [1 M- x( {" n/ w2 d
var vbInformation = 64; ; K; W! v3 a& f/ _) ?" Y- T
var Finished=false;
* M- O: W# p1 }% U
) a7 |7 s2 p- |5 c( \; O6 x; svar WSHShell = new ActiveXObject("WScript.Shell");
* h, t1 e. D1 k# o9 C # J2 I3 I# K7 P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 |; j2 a1 w! v: p: \' |# A$ x+ p
5 ^, x, ?8 ^* G: |# w |
simple.SetLicenseType("Runtime");
c3 k$ T. i: c- X* w, J% R0 K " n2 C- D% g" s$ J4 K. j4 o8 [5 @: H
try ! A5 _7 q8 `4 v+ H& |. _
{ % E) J2 V3 R$ K, B Z0 A
// Enter the path to a model file!
9 b5 `! G6 k+ n simple.LoadModel("C:\\Models\\Test.spp");
' b0 N7 o( k( { q( p, n. B5 }3 x}
( Z* r) n9 k2 v7 Z1 rcatch (e) ! [9 |% z; g. h, Z* U
{
" c1 [3 t( B0 H6 ]% \/ ~3 q WScript.Echo("Could not load Model!");
- R6 t" j {6 x1 M' Q& Y' x# U WScript.Quit(); # L: W2 U( _3 w+ }. d8 O4 C7 F
} ' l v& z3 Y- O- f; I
7 p1 |. y" c; \4 U1 B2 `
try s v3 }1 I+ L. y/ k y1 A
{ 8 H/ H7 J% p6 O# S' @% F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 ]. {' z! q$ L r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 K- A' n% G; ^ if (r == vbCancel) * A& S6 ^; f3 u$ S1 p4 r0 A: Y
{
+ f& {) F+ a Z! k0 w7 @, A4 a% K simple.CloseModel();
+ @" @/ h- U$ C WScript.Quit(); : y: f2 w- {' s7 n! ^
} - s$ ^0 V5 e1 M6 H: }% K0 d
}
7 I# p! X8 [6 `0 o8 c
/ s. l$ G, E" i w, Esimple.StartSimulation(".Models.Frame.EventController"); 0 C1 X6 J& `" ?: l% m
w/ r6 \& h7 ~! gif (simple.IsSimulationRunning())
' C- D: P! }( S/ j; \2 Y: d WScript.Echo("Simulation is running!"); + {- M: S) h$ I$ ]
9 s8 j! V$ Q6 C& P
// Wait until simulation is finished
( K( n* b: c3 t; C% J! n {while (!Finished) WScript.Sleep(2000);
' `- y3 M. X- I B3 G3 \9 L- ]: P) M
simple.CloseModel(); 8 a" R4 s& o9 I
simple.Quit(); 4 [4 J! X# \! M3 i" L% k
WScript.Quit();
/ p, O: F* c' i1 }0 {: f# e; i* ?
& h/ [! Q& ]* R& o/ e * {% q2 G" C( L( @
function RemoteControl_SimulationFinished() 9 ]6 Q/ l) C& j+ n/ l1 \
{ # d$ `1 E: Y$ d& G% H( K
WScript.Echo("Simulation Finished!"); |