Example of a JScript / Y b X$ b4 j- j
var vbOKCancel = 1;
) t& z$ u3 |$ W. [( r# s$ N/ {var vbCancel = 2; 7 A7 O# b: B) }. h, b
var vbInformation = 64;
2 P$ `. g' ?. Q& S3 d7 {var Finished=false;
]9 _* o) E J8 s8 k! ]. ~ ( n& W4 `# x3 h0 g2 p
var WSHShell = new ActiveXObject("WScript.Shell"); 5 m& k/ I" A8 B, y4 Y1 d4 d
8 o3 a" a5 R& a% H7 j. j$ r/ o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 L7 ~! S4 P/ K/ V7 d0 t" U
. `. u! N5 D) P2 Esimple.SetLicenseType("Runtime"); + a, M; B9 Y% L9 g% {* L& w8 x
" L+ m4 K U" C7 W! }; R
try 7 ?, R Q4 G& O9 C0 p, w
{ 0 P$ l4 p7 U+ T7 Z1 \% Z
// Enter the path to a model file!
3 O9 b; @- h& t5 b simple.LoadModel("C:\\Models\\Test.spp"); : D$ j! m; Y/ l% X
} 5 |: T* D5 n. X4 {) F
catch (e) * x8 `" a% D8 w6 Z' ~- Y9 P
{ 0 f" D1 w5 R+ R% p, b1 v- Q
WScript.Echo("Could not load Model!"); 8 [2 }" f4 R! Z3 z
WScript.Quit();
8 h" i! C) f( K5 K1 T& T}
& e0 r! v; O6 }" w + ^: J( ~' c% Z; O
try 2 l% _+ u. r# w2 d
{ 3 i9 k+ k/ {5 k y8 U8 ^4 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 T( O6 _( u7 V r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & i4 }/ O4 y' d6 c( S- D3 Z) M
if (r == vbCancel) / y" y* c; R- ~6 K: [
{
' ^* V! J" O* d7 s! ^ simple.CloseModel();
; U6 `2 T% V+ V# \5 | WScript.Quit();
O( L: P' [0 P2 _0 x, [ }
5 ]; K7 x! F% F3 R: w' @}
" ^; M V8 t$ D/ u: m+ L1 i ; H* B4 e! a1 D; I2 i1 `
simple.StartSimulation(".Models.Frame.EventController"); ' q# @7 A n1 g! f; x, [
1 ?7 V: \, ?9 I" i. m* Aif (simple.IsSimulationRunning())
: `" I% \" g& E! C/ {( b) E1 _# \) Y WScript.Echo("Simulation is running!"); 5 Y8 \! P. N, ]4 Z; b5 b
) C) c, J0 Y6 [. ^6 ~9 o
// Wait until simulation is finished $ C9 m; \; p& v7 }# h) d
while (!Finished) WScript.Sleep(2000);
4 o; }, F! T/ I6 t6 p. ]0 c 8 t1 \: ]) M. p; W6 A
simple.CloseModel(); ) b( P8 U; A2 b- X! |) {6 G2 \0 s; R: g
simple.Quit(); & s1 O1 U Z! b% [1 T
WScript.Quit();
) k6 ]1 Q$ q6 E% a! V/ b; P% I 5 {& n @/ o+ G; ~& r" P
% K# g5 ?' I# }. y5 h. ^1 d
function RemoteControl_SimulationFinished() [2 e/ Q% O w* h c8 s+ ?6 ~
{
/ y E+ h1 J- E WScript.Echo("Simulation Finished!"); |