Example of a JScript
- h+ Q. z6 W0 {/ tvar vbOKCancel = 1;
2 y( O. s& d9 _9 ?5 [/ nvar vbCancel = 2;
3 B) o \8 x7 y; ~5 S c! kvar vbInformation = 64; / @% x% b3 F/ w! {; A
var Finished=false; / Y) [ h- r: T+ b
1 O c( T* H. o3 n$ U5 A0 {
var WSHShell = new ActiveXObject("WScript.Shell"); , E! E6 }: X0 W9 ~; I, r6 S
. G5 V/ n, P% J5 A8 h4 _ @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 @' X& Y. Z' ~5 R! b5 L
- a- b2 W7 k* r/ {: J
simple.SetLicenseType("Runtime"); 1 S+ d8 |8 x3 O2 J9 ]
/ X# K7 D5 p# _9 i6 t* E% D
try " I9 @* X- s T+ K. [
{
0 B8 h4 p4 I* w6 P/ H // Enter the path to a model file!
^7 L/ C$ [; S1 a5 w6 {# s simple.LoadModel("C:\\Models\\Test.spp");
0 s/ J$ X/ C% F: z+ j}
/ R4 L6 h9 Q, J8 A( y! Bcatch (e)
@& ]! D: F* h( t: y$ }; ?{ & p. g3 c8 }1 }6 ]* a( V2 R
WScript.Echo("Could not load Model!");
' N0 _, [7 q/ U: a9 t3 A WScript.Quit();
1 O! h. H* V U) I K; M. c} ( ^$ @" Y6 u& ?; ~
6 T6 l& }- A6 a4 a2 J
try % K% M) f. J4 }3 E, g0 m( `7 d; l
{ ' R& U2 K, Y! G! v4 _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 m0 N6 p6 P5 Z' G9 T
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 h8 l" B! m* X! n& ]4 y' ` if (r == vbCancel)
% S/ s' C a5 } { ! ?2 b3 T& B1 E' m. o
simple.CloseModel();
7 w2 [! y8 H# d2 x WScript.Quit();
3 Y6 }' v" e3 ^8 J$ f. Y: g& o } 5 `) S' S4 i$ z; d( Y* U6 v
}
$ q6 M8 E6 _6 C* [ " P! T, }) v% G$ g+ I4 T1 ?
simple.StartSimulation(".Models.Frame.EventController");
- B6 A# K; J4 p% \# V7 k/ L1 I) G . l! K2 p: K9 `
if (simple.IsSimulationRunning()) 1 b- I$ w. U7 Q J7 [- z
WScript.Echo("Simulation is running!");
( d+ D' `% _/ F$ g0 w; ?
: \5 `/ S+ T/ ]9 N5 D# k" a; _// Wait until simulation is finished 5 q5 W; p* `/ Z9 }
while (!Finished) WScript.Sleep(2000);
8 {! p7 [! a3 q9 t6 T+ ? ! F5 @- @7 B! M* o a0 j0 `# x
simple.CloseModel(); ' V3 Y2 @, e* {8 I( G$ f; Y
simple.Quit(); 6 u S3 ^& Y1 X$ [' v6 p1 y
WScript.Quit(); , |4 y% H* B3 M1 ^* R
1 _* ?4 ~9 C( t5 ~5 }
/ r1 F( E" p- x' T1 ~function RemoteControl_SimulationFinished()
5 v; I) \) H9 ~" W1 \6 ]& c& U{ % X4 ~5 B. I: I# B" ?% z
WScript.Echo("Simulation Finished!"); |