Example of a JScript
: ~4 v" @; V2 o1 Rvar vbOKCancel = 1; 8 R/ M' ~9 E" M6 l! z, m- s
var vbCancel = 2;
/ H( I0 ]0 I5 d, Tvar vbInformation = 64; # u* z3 B: o& V3 h/ o9 j
var Finished=false;
9 b1 {$ Z6 j6 o( Q' {
1 n4 e* R, @. H, Y% {7 d4 l* ?" R: jvar WSHShell = new ActiveXObject("WScript.Shell");
' Q& A1 p& ^+ X' X2 z0 k9 y# ~) }
/ l" b6 @( M3 c f Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; ]* F* S2 e; P % k# e" ]$ g+ _; [- q5 Q5 ?
simple.SetLicenseType("Runtime");
5 g0 ?2 b9 M: M% x4 E2 O3 j' A + ?8 @; j8 \6 O" G' P
try
7 L3 L" q2 ~8 ]" q0 Z{
$ _7 y4 D0 N" I) L // Enter the path to a model file!
j3 D5 o: G2 U E simple.LoadModel("C:\\Models\\Test.spp");
, w% i7 A! r, {# S' E/ \} 1 U7 B% B! g7 O# G% V, i2 N `
catch (e)
; Y, I' V- j3 w$ \6 l6 a! S2 S* b{
6 r, E/ H" i) {4 Q+ ?: c2 i5 \# c WScript.Echo("Could not load Model!");
1 L6 M9 x) z2 v2 w j. J WScript.Quit(); ! R1 r# |* u% u. _- y
} 9 F5 N8 @; x+ | i' F
; m$ Y3 U- R% {: Dtry % h; r% ?2 w& e
{
9 Q3 }* {8 r& H4 r3 m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 \; m% V: M# F2 f8 o, n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( r1 x6 u8 P' a if (r == vbCancel)
! i% a& {. Q- \ {
* h7 F7 L& h0 @ O5 i simple.CloseModel(); ; [2 V5 S4 p9 g, l
WScript.Quit();
$ m% ~1 B8 T1 [: d* G } n) P0 N/ F' \. I3 ?2 S
}
) u; Z0 T! T3 k8 ` 6 _) p( f* l2 N, Q3 p
simple.StartSimulation(".Models.Frame.EventController");
# n% A% M5 J( I# r( n
2 G( ~$ x3 Y& }2 ^if (simple.IsSimulationRunning()) ! ~ ~% R* X- L/ q
WScript.Echo("Simulation is running!"); # d! U2 x: N- O
1 N8 f, b& }: Q& y- C. W3 n: O j// Wait until simulation is finished
! i. j& c8 Q7 X& n- H5 zwhile (!Finished) WScript.Sleep(2000); " E) U0 H& B1 F; ^- V* t
( B1 L4 s0 k+ b2 H, |% O% m, Zsimple.CloseModel(); . x* t6 U0 c1 \; l9 x
simple.Quit(); # ]( K1 X$ A; B7 E0 w6 E3 M
WScript.Quit(); + V2 z8 k7 }4 J$ g
5 I7 p& s4 W# N( g / E, ]6 H9 B! Z( \
function RemoteControl_SimulationFinished() : e. A% ?! k/ u/ |7 \; g
{ 6 |2 J# j9 W0 R9 N2 [
WScript.Echo("Simulation Finished!"); |