Example of a JScript
( L+ i9 M, m4 P2 k3 r- Dvar vbOKCancel = 1; / n) a3 b' M$ f; q& q
var vbCancel = 2;
* l- Y K G: r& h1 Q" o! Svar vbInformation = 64; 4 j4 M- G- h+ S1 x$ `
var Finished=false; : j* }8 \! u, n
# f8 Q: Z1 u1 r. i1 D2 H! A' D( q
var WSHShell = new ActiveXObject("WScript.Shell"); 7 I3 \' Q, E' t
# B9 a) L0 S. s2 q) ]1 dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / l: [) C+ P- D4 m6 h
' S4 P7 J3 x1 k @) I, d! s
simple.SetLicenseType("Runtime"); $ i7 X# ?' b" S' M0 H3 A9 u D; t
9 b. A4 l$ g4 U3 u: k& w! F1 \try 9 t0 g) H$ W3 C, b
{
+ U" t; p4 X2 { // Enter the path to a model file! * j L1 J3 z; S% R* @
simple.LoadModel("C:\\Models\\Test.spp");
! }, }) U; j6 [}
. R. O2 b7 k7 dcatch (e)
0 n, G/ j3 q# T{
; b) X$ [+ d, N, D o$ o WScript.Echo("Could not load Model!");
5 J' S7 H' `* s$ D% { WScript.Quit(); ) g1 j$ _5 I+ _, i3 p, w: z9 d0 x
}
, [# w" V) K Q5 P! K: d/ ?# F8 M 8 }/ [9 Q* a5 T# A9 R3 o
try
. E/ K2 |: g! w; i4 K: b{
+ w" O# P- i# K, y( m3 E) D8 {- r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + m8 W1 u# _1 `/ u; I& i2 [
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : H! ~5 K/ n/ N" G" O$ O( p
if (r == vbCancel) % S) W; L, |; a
{ . n( u i3 |+ C `
simple.CloseModel(); + m- {4 M. n( u, E. J$ Q* h" y* ~, s
WScript.Quit();
# n+ Z0 o9 }3 {3 Z }
3 s3 u: e4 ?' v; r! X5 U}
/ o8 s1 E3 w; E0 e
) P. J' x1 w: a. V9 s$ p1 Y3 u* _8 Tsimple.StartSimulation(".Models.Frame.EventController");
2 O) _6 v' c- W$ c6 y, }/ F: }
3 i6 O- m$ @$ vif (simple.IsSimulationRunning()) : k# I! C# p" P2 M- H$ b6 [3 K9 ?
WScript.Echo("Simulation is running!");
; g; G( G1 I6 g* v" l- c# u ; N. b, P; \2 r M- B6 M5 e
// Wait until simulation is finished
$ s! n7 z" `3 d( @2 E6 Qwhile (!Finished) WScript.Sleep(2000); + m0 X5 T2 t) N7 ]3 `8 v( D
' ~# M) A0 }$ Z! o: D& t
simple.CloseModel(); . s; j/ a: [0 K6 l, m4 v# o
simple.Quit();
) g& X! Q& S. Q" mWScript.Quit();
2 z3 q. S+ B( Y; w: J8 Q
" ?5 M( [0 W4 _& J( u1 F7 a5 ?
' U# t" s0 | A u; A1 wfunction RemoteControl_SimulationFinished() 8 b3 \& `- P- s/ S9 T
{ # t* u+ @# p2 K- s
WScript.Echo("Simulation Finished!"); |