Example of a JScript * g! h7 D2 k1 w0 m, }! e$ x
var vbOKCancel = 1;
% b W7 }2 U5 } V2 Wvar vbCancel = 2; ( U! P$ N6 f0 k6 ~2 L/ ^
var vbInformation = 64;
& o8 }4 [6 w2 ~/ f- }var Finished=false;
6 J4 Y- D% t% S) J# L
7 v$ A- X$ P0 @6 ^9 C- Jvar WSHShell = new ActiveXObject("WScript.Shell");
9 E: T2 I) Q" ~8 ~: b9 `* K. V
: p' K. d3 A1 ?) G# O9 s7 Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 ]6 d( W8 T' _; O" ~
! S* ? u ~8 ~' ~ \simple.SetLicenseType("Runtime"); ; ^6 h7 b4 W% W4 r/ g* r: l
! G* l& `3 C" ~2 p/ S! Atry
/ ~; d4 X. o4 G5 c{ " M: X9 v, m/ Z o/ l1 A
// Enter the path to a model file!
; t' K7 K: m* O1 R, F simple.LoadModel("C:\\Models\\Test.spp"); " q5 f: O0 |0 e! U, J$ u
}
( }8 F% |4 m( V5 p3 i f0 {catch (e) 8 i7 {5 f* N z' E& A+ E
{
7 p# F: |" m8 U3 @% }: G l- A WScript.Echo("Could not load Model!"); 2 r0 F" I2 p2 m: }% ~1 N* ?# x
WScript.Quit();
4 _+ i" j" W7 W% D1 E}
8 _: ~- N: r7 @7 a2 H ' Z1 W4 b1 B9 ?* J' G: _
try
& l- h3 B' B# d6 K{
8 a( Y2 \5 m8 P3 C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * V ]; i$ f$ {3 E2 @& O! f7 ]
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% B! l7 Y; e% c& J3 W3 {+ ] if (r == vbCancel) 7 V0 o) ^( x+ s/ |6 B9 ?* n
{
7 D0 e" [0 N& ^; _; Q simple.CloseModel();
i1 G* K, U. z3 l3 g WScript.Quit(); 3 u+ f! M' L t: O' Q
}
: p+ d7 Q9 F" V9 D: W* U$ P}
+ ~! {/ X2 G. O8 r( |8 D ! v; c/ H* ?1 m j8 H8 @
simple.StartSimulation(".Models.Frame.EventController"); 1 h g# z/ u8 X8 J, y6 ]9 Z& v
' i( U+ ~6 Z. b& k' f6 H! {
if (simple.IsSimulationRunning())
2 w: ?( `9 {8 ?: \- T1 y WScript.Echo("Simulation is running!"); 2 a) R9 @3 V; t
% k: U( b' D( K y: E6 y, f// Wait until simulation is finished
6 b8 G9 \/ _8 I* ^. C/ owhile (!Finished) WScript.Sleep(2000);
4 j2 a; d m, F, i7 y; a: j: x$ d
0 U" p5 _" X) E' e) ^ ~simple.CloseModel(); ! Q8 Z# z2 f$ q8 Q1 s3 s
simple.Quit(); 6 ~, D H: H" T* T9 g; C
WScript.Quit();
4 ], ~1 a' n9 t7 l1 [ # Q, W2 a- R0 |4 R- H+ {: o
( o, D/ \5 ^* \) M7 Lfunction RemoteControl_SimulationFinished()
$ q4 \: b1 @7 Y8 ~{
5 g2 @; B+ F5 {) `2 w! _9 N WScript.Echo("Simulation Finished!"); |