Example of a JScript ' J+ k: j: n2 a
var vbOKCancel = 1; ' i$ d( }# A, v9 G: x, a
var vbCancel = 2;
8 T( ]' K i6 O6 vvar vbInformation = 64;
0 h0 D+ c' H/ A) t4 n: a$ S- c ?var Finished=false;
, {- d' s! T3 X9 q. s6 K" y6 S
" X7 f# p9 \+ b( w Lvar WSHShell = new ActiveXObject("WScript.Shell");
! m2 }: c' u V# Q9 t * I" C1 {+ B; |0 `0 d7 ^# t' L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 b+ O6 A' O: g
3 R" P" u% s7 y
simple.SetLicenseType("Runtime"); 1 b, T" t. i9 \- M; s/ u8 g
" c' w- `( x j- |. l( C: E: ]
try " A9 z4 [7 }& l* P, Q$ A1 I
{
* T/ q& i [, H // Enter the path to a model file! * E; k6 |& N. U8 {4 V) ]: _
simple.LoadModel("C:\\Models\\Test.spp"); ) X. d, [( `9 U' l9 @) L
}
+ i' y; ]; P' \" qcatch (e)
+ a5 s+ @) a S1 s8 y. l{
% d; _- n" q* V6 D% V# r WScript.Echo("Could not load Model!"); : o. ~: B, b4 F8 h* t
WScript.Quit(); # W- b8 z: I7 t4 K# S3 G# C4 o
} 9 q7 Z$ a' I8 H% A
; X4 E; C8 a2 r( q( l+ a7 Gtry 1 B4 l- B2 {5 c3 V# p
{ 2 L/ D8 S, U+ g/ [
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 R4 g* T3 v9 p6 A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 y: r; i' O8 l7 @, \
if (r == vbCancel) ' R" D3 [; c# R& y. g
{ 9 C3 u: H& d& v; _2 F5 H, P: U
simple.CloseModel();
0 o- L; [: \- A WScript.Quit(); 0 Q r' Z( ^0 L, K7 c! e0 G
}
5 ~2 j2 m! ~2 P& W}
6 @; V3 R3 B+ b! m% j, \
j' T' X$ ^8 o L& C5 O- usimple.StartSimulation(".Models.Frame.EventController");
0 b6 Z$ v# x! u& j
C' d3 h7 G# q7 d5 r5 J) iif (simple.IsSimulationRunning()) / U3 H* T/ f3 f0 C; `& O
WScript.Echo("Simulation is running!"); 8 q6 {5 L4 |% A
) m3 @2 z# e) G, ?) D) f3 L6 d
// Wait until simulation is finished 1 i+ e0 O2 U& ^. M3 j6 G" Q
while (!Finished) WScript.Sleep(2000);
+ _- ~! i/ @( u" F' B
5 Q- L6 s9 E" x" h% esimple.CloseModel(); 6 a* k1 t0 E' N0 U* q& _+ T
simple.Quit(); 9 ^: O1 ~2 r1 U3 G8 ]
WScript.Quit(); , B* w9 N! C, [. e3 q3 y
7 R& u' c( z1 Z2 d! Q1 i) O
& V; W3 c# u8 z1 A3 W+ a
function RemoteControl_SimulationFinished() , d6 i% w$ m$ r+ S% s+ U
{ y7 l2 Q8 C8 B% H! q
WScript.Echo("Simulation Finished!"); |