Example of a JScript
2 @" s% m" _$ X7 Svar vbOKCancel = 1;
+ _, t% O5 j; e+ m1 g& vvar vbCancel = 2;
% c: R9 i' {! r7 K: K4 Bvar vbInformation = 64;
/ A& m) L3 p2 X( x& n) W7 uvar Finished=false;
! v% y2 r4 F' ?
" t$ H4 F9 c- c/ B- R& mvar WSHShell = new ActiveXObject("WScript.Shell"); 8 _+ n" x! h8 F7 J3 ?' o8 U
1 D' R V" R b4 |3 m0 ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) Q& b4 i6 X* ]' }
# x) b6 e9 i. ?% ?5 ?' H7 d. l
simple.SetLicenseType("Runtime");
' k9 Y& B; n" X3 b5 E. B6 g: E/ _
6 n2 \7 b9 l( _try - P- N% u6 s% _* A I: J% Y
{ , h) y( `5 u; l+ L9 d4 W( A
// Enter the path to a model file!
0 U$ Q) p' C; @4 N# e; S4 x- ` simple.LoadModel("C:\\Models\\Test.spp"); 5 V5 Y) `8 o+ B! ]/ H! z5 E/ D& @7 k2 z
} 9 t6 U% x6 E3 d& o
catch (e)
- A9 r% T! }% L/ p{
" ~: L! x: ?" _+ Q9 X WScript.Echo("Could not load Model!"); 9 l$ M' ~1 ^# ?3 _ i7 W6 `* y
WScript.Quit();
$ z2 M' {; A- K6 W' N% |- P} & h4 W% n/ K; U5 L
' `, `) c& I. k5 [try
9 Y/ Q- p3 s9 w; O{ ( o8 V2 C R# t
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ d* u9 V: z, d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . a* H% B, c6 Q5 X
if (r == vbCancel)
f5 n4 X0 }, b! W9 I {
4 m' M5 i; b9 @ simple.CloseModel();
( u5 F6 v% z/ O ?& c WScript.Quit();
# |$ w( G' R4 o; A O- a& g1 ^ } - ?$ z& g9 u+ [- f6 v/ f5 S
} / C* X7 l/ w. c% S0 D( r
! m. J5 _) H! Lsimple.StartSimulation(".Models.Frame.EventController"); # Z( T7 t7 d! [" `5 Z0 i
+ M% ]: N6 x; D2 p( {3 N
if (simple.IsSimulationRunning()) - Z* m6 e, g$ ]: F, `# d/ A
WScript.Echo("Simulation is running!");
: w8 S1 V9 C. [. d
$ Q( ~8 O: P2 {9 f: V9 H) N// Wait until simulation is finished 7 l. e; v% M' Z" o+ }
while (!Finished) WScript.Sleep(2000); % K1 @6 A1 M7 t+ I
& O, `" y/ V' Esimple.CloseModel(); , r; l: h9 f7 d7 n% j. G/ W
simple.Quit(); % K" H' U+ K, h4 _- M6 u: w
WScript.Quit(); " H: f- v8 J1 ~' o o4 `
/ _0 U) D1 g4 y4 G) o" ?5 `
2 k7 W# Y0 n, f' W
function RemoteControl_SimulationFinished() - w0 b7 O, e( I; L! I& M1 C
{
/ l5 g; B# J* b( g9 }9 [8 y9 j WScript.Echo("Simulation Finished!"); |