Example of a JScript
1 p5 i. J7 d" I5 ?" Q' k: ^9 c0 {var vbOKCancel = 1; 7 B) m' ]5 z; J
var vbCancel = 2; ( h0 L( w3 z/ c/ p
var vbInformation = 64; 6 n3 k. o, l, Q4 ?) p
var Finished=false; $ m: Y& @- y! d+ x% b1 B
3 }& @! u! [" i h- I* Ivar WSHShell = new ActiveXObject("WScript.Shell");
+ p0 H' G a( w6 S' U. s& t ) K) g8 u& O0 F. J
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & ]1 S/ x( W/ [3 V+ L
" W; |; G& n3 ?8 B" ~; n
simple.SetLicenseType("Runtime");
v: t( y p/ J/ z, L : @8 O+ A0 [4 n& K9 `8 Q( V$ L0 p
try 8 @# j2 o- ^8 [
{
1 n9 M: q9 `4 R3 g- i // Enter the path to a model file! $ a% \5 m' S% {& ]5 F. w) z. G
simple.LoadModel("C:\\Models\\Test.spp");
5 K) ~" a% t7 M! P2 Z) n& F} " R- i( N# \2 q
catch (e) 5 t9 c1 @7 n6 @, i2 Z
{
7 c1 v! O# T) V* j( O WScript.Echo("Could not load Model!"); 8 |/ ?1 G6 H2 R
WScript.Quit(); $ G% E$ M$ f! U" T6 \6 Y
}
+ {4 h9 F. d+ g- D# p _) z5 K( Y
0 B: Q' m7 G9 r4 d! o6 ttry ) s2 l5 \+ K6 n0 e; j* |2 |% ^% G
{
3 k' b( e. v% n. h, y- A% F0 F simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 L4 N0 F4 [& H# d- k, @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % o& e, @: |" o; g4 L+ d1 R
if (r == vbCancel)
( e7 K7 Z, a6 N- m { # Z" s* Q4 p: q
simple.CloseModel();
1 z; Q7 q( Z6 N" K# n0 I WScript.Quit(); , `. C! s4 O6 Y2 K
}
' A; b* O( b" _}
4 O2 L* ]9 M4 f g1 B# x' k& a- K # _6 ?2 f9 t( p5 {( b1 d
simple.StartSimulation(".Models.Frame.EventController"); 1 C, `6 W1 b! a. \ j+ N: ^( G% O
7 ~5 X$ s7 R+ {- D- y0 Oif (simple.IsSimulationRunning())
7 d5 K7 j b/ r5 \' k- H6 n WScript.Echo("Simulation is running!"); 7 i [% f( }; z' i4 ]
q4 w6 s7 x& j# u5 U1 _" A
// Wait until simulation is finished
$ L. K; q( y0 B( i3 X: ywhile (!Finished) WScript.Sleep(2000);
4 [) b& s9 f# Z2 B& @
" k u* t- b2 |/ p; ^4 J3 rsimple.CloseModel(); 1 D5 N4 Z- r0 _! d, Y$ H' q7 i4 I
simple.Quit();
. P2 b/ I* f8 d7 B+ j7 W' KWScript.Quit(); ) ^, F3 f+ E( P+ }% P2 Y: O" [
( e0 k" K |' z; v9 P1 a
6 f# }1 w9 B, l. f L: j
function RemoteControl_SimulationFinished()
$ g! q# R' R' p; } z1 t{ 8 `2 P' A& V# {8 i
WScript.Echo("Simulation Finished!"); |