Example of a JScript
2 z$ }/ ~1 Q& x! Ovar vbOKCancel = 1; , [: M9 c. W% b3 O' u
var vbCancel = 2; , t6 J/ X4 ], O5 p. k f3 L3 ?
var vbInformation = 64;
# }2 {! w+ m2 Y% ?/ m9 E2 q+ Vvar Finished=false; ! K2 Q w4 {8 V6 `* l$ `, d( @
/ \6 j8 f7 L2 U! l) M
var WSHShell = new ActiveXObject("WScript.Shell");
8 h ]- w9 v6 b0 ` * v: w- ` K9 p5 A0 ]/ t* s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! c# O% s/ T% q
+ o& O9 h& o- J: O0 n1 Q3 usimple.SetLicenseType("Runtime"); , Q4 S% P% M! s
/ e6 c' w* ?# ~5 `try
1 F8 z9 q8 t+ a3 Q0 K: d{ 2 l4 y9 W5 i/ |1 @7 m: T2 g t
// Enter the path to a model file! 2 F& [$ _3 S1 W
simple.LoadModel("C:\\Models\\Test.spp");
+ V/ p ]3 F( E% n}
. s6 W' f# {$ l9 jcatch (e)
' E) e/ T; r5 @{
4 E' y2 { F* c: A6 ^ WScript.Echo("Could not load Model!");
9 t. f: e. j% T2 @3 E, B* B. M WScript.Quit(); 0 u& {) w. Z" S' y" d- E0 Z, N
}
3 c: ?7 ^* {7 c# [+ _) g2 p
" f1 y5 a5 _7 `* K% G. ?% u1 ~( ttry
, T1 P! L" e" P- ?- L{ 0 a4 A1 h; O: I/ b9 h$ u; c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / [& g% n6 f! X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . G$ m' C& S q* `) D: j r9 p! `6 j2 q
if (r == vbCancel)
: d5 X2 N! q8 i {
: o: Y$ R9 e! |4 E9 H4 j simple.CloseModel();
7 u `; D3 y* [ WScript.Quit();
% u$ _! a/ _3 ]6 U" F }
1 E; v. D. E+ x8 ?! [ `- X3 e5 R} * E/ r+ H, {- F" T
: r+ f A" }+ v% s3 psimple.StartSimulation(".Models.Frame.EventController"); . `# c& ]0 L( @: t0 F: }% M
! [3 s q. e2 Q
if (simple.IsSimulationRunning()) 4 H; |9 U% U/ u) ~
WScript.Echo("Simulation is running!");
+ ?. ~. r/ B* r/ y
) X2 g% V) w3 R: Q3 Y// Wait until simulation is finished 4 v( m, W/ L, F) n/ {
while (!Finished) WScript.Sleep(2000); A4 x* B. K( V; C x: Q
) G" o5 M+ r7 N/ C/ k7 B# j
simple.CloseModel();
" W" ]8 |, J' E, Q, X8 {simple.Quit(); 0 G: Y$ y [ g% Z: R' u- B" K! f
WScript.Quit(); 8 P V) L7 ^2 C( M _- Q! T" Y: U
) ?9 g6 f! Q$ v9 h* }* q* D! l! i 8 f" f; k; O( A- _: D
function RemoteControl_SimulationFinished()
" w% _( t# F+ W3 C) W{
; ^1 |4 w; J8 X! K. V! y) i WScript.Echo("Simulation Finished!"); |