Example of a JScript
0 A( q! x! f Bvar vbOKCancel = 1; & K; S9 N$ _1 q r' f9 k5 W
var vbCancel = 2; 0 D0 X* a: g1 c6 S+ z; U: D
var vbInformation = 64; 4 c- V$ c/ A _/ H0 R% V8 D
var Finished=false;
) E' }/ `& p: r1 I9 j
5 ~6 X2 [$ J7 P" K7 a, Evar WSHShell = new ActiveXObject("WScript.Shell"); ( @; }) j/ _; `+ H* v r
! e, h# D8 I% h5 X" H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; o, |' O$ `& H1 J* g
* L+ d) u$ F( O, {simple.SetLicenseType("Runtime"); # @. \* l4 ~4 i( J3 q& A0 \) s
/ F! S) R/ X, M) w8 ptry 0 o! @: u9 F; J
{ 6 O4 \: a2 {% l% z% s
// Enter the path to a model file!
; `" ?* f2 L: O- q simple.LoadModel("C:\\Models\\Test.spp"); * @9 o: E9 I- Z, R: c: C# D9 c
}
2 \0 K- q" ~, W6 e2 U5 x. ?catch (e)
0 }, T5 ]2 a* ]5 E# n* ]; G# r{
" |+ y- C+ t- f* f* e' ?! b' ^2 A WScript.Echo("Could not load Model!"); ) L! j* D) X! E' d5 F n5 H
WScript.Quit();
, {& b5 w1 N* R+ `) O1 q% u5 I}
" U4 ~' s: P: P) D- A + \9 h, @$ E* W: n
try 8 p6 p' y4 }2 ]& C8 y2 z' x. H
{ 1 e, m, a3 e* q4 q6 o+ S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 q! h, W& l- t. s3 [ W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! |- l3 Z4 c, |- k$ }" o8 `2 b# M if (r == vbCancel) : N( f& n( w" V$ `9 }
{
$ P/ ^4 a9 ^" ^ simple.CloseModel(); , |$ R! g4 V. [4 B0 a9 \' o* o1 a7 L9 B
WScript.Quit();
0 j% q$ {$ _. t$ a7 k; ^8 b5 M } 3 u7 |- P* Z; s3 u( {) g+ p
} 3 K0 J7 E, B! Q6 Q! ]
) s2 I2 p* Z: i; m
simple.StartSimulation(".Models.Frame.EventController"); 9 U5 K0 i) O! m4 E: a. m9 K5 y
& j4 m* s% |. Z$ o7 H( R/ H
if (simple.IsSimulationRunning()) 6 t6 A# E/ K+ W- S1 o8 X0 s+ M0 V
WScript.Echo("Simulation is running!"); + o5 [! N7 `# r3 T8 A4 i
+ T& r( u4 U0 h6 ?, a) {. }// Wait until simulation is finished
# U7 x% c$ N5 h C/ nwhile (!Finished) WScript.Sleep(2000); 1 m" x( _0 D3 m3 I9 b/ r
; W; R1 M0 B! u$ l$ D0 N6 psimple.CloseModel(); 2 d2 v+ g- P* E
simple.Quit(); 3 i) v- h) g. _
WScript.Quit(); ' y# i) {6 y7 h2 g) e+ ?1 n/ o
, _/ t. S7 J# y3 c
, W5 C: B, I0 ]/ |3 O
function RemoteControl_SimulationFinished()
' K0 M" O( y6 @. m5 G{
1 e. M! U: u9 H7 C WScript.Echo("Simulation Finished!"); |