Example of a JScript
" x) l' v' l4 {. y: fvar vbOKCancel = 1; 6 ], N0 @- }* H1 B: e6 ~
var vbCancel = 2; m5 y7 r7 d9 [% [
var vbInformation = 64;
4 W1 S2 N. ]+ c* ~; H, X6 bvar Finished=false;
( H0 }& j( N" T* ?
# U/ f. `" Q+ V$ W+ z+ ?var WSHShell = new ActiveXObject("WScript.Shell"); * ]0 e; R1 T; r. k
% t0 ~ |9 Y, n- e6 v4 M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 g9 r$ ^) x4 K1 H
6 w. D5 w" M/ a6 j+ J1 Nsimple.SetLicenseType("Runtime");
5 U2 T$ ~! H A
* R& I* D5 T1 Jtry p) w& c3 D& u- Q4 g
{ 5 ~$ t% F9 u' X2 R8 I' a
// Enter the path to a model file! V$ E' b. P% A' i4 g0 N
simple.LoadModel("C:\\Models\\Test.spp"); : g) z& L J" C. p7 C
} ( I7 [& ~+ k! X8 ^! v
catch (e)
* t* k. U2 b8 R4 T2 I7 J{ : k, Z" E/ G: O, b& r8 t$ X
WScript.Echo("Could not load Model!");
0 q8 i, H1 o3 ^" b WScript.Quit();
. q6 u# U$ Y: O' ^} 0 o' r% w! ~, K
F- M& L/ H; M' N2 I5 S- U G
try & y a, L1 K$ H8 I' R
{ 5 C! D6 W2 @- {8 @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 e$ b( I$ U8 A
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / p7 B) r7 f( S# `* Y# l) o( ]5 C
if (r == vbCancel) % D3 D0 t) y2 s$ G. j3 ?
{ 1 o4 ]/ R9 @/ P( a' H* V ~
simple.CloseModel();
" N! Q, c9 U. g+ s' _& A WScript.Quit();
; n+ ~" |7 b" M( N5 X } 5 D) r5 ]5 a! t; V$ o
} " N2 M' Y& a5 }# a
8 c5 g" w5 B" ]/ z5 U4 d! l' Msimple.StartSimulation(".Models.Frame.EventController");
o l) l _2 U6 c& _
# P" r8 s+ h+ x3 T3 A8 aif (simple.IsSimulationRunning()) ; ]9 G% P2 a8 k
WScript.Echo("Simulation is running!"); 2 u4 u: d, e9 |2 t: e7 f$ n
% S2 `7 [7 }/ n. i' i! \% U
// Wait until simulation is finished . w# f. v& b: ]1 g" i$ w3 r
while (!Finished) WScript.Sleep(2000); 0 Y! `( D/ L n1 o+ `3 n; S1 o7 t3 `
5 ]! K% X0 ~. V2 B/ D8 Ssimple.CloseModel();
: U+ e3 C* `! ^% `. a, c$ @simple.Quit(); ) H# t3 g, I; V5 O. a8 C( n9 Q
WScript.Quit();
9 C4 n# H- |( W4 l! o
5 m" Z& z+ @) o) X3 A. { 0 d2 U5 h9 }7 ^: o. V5 {, ^% }; x2 w) I
function RemoteControl_SimulationFinished()
! y' W: g$ v4 F* N9 @8 I8 C" {{ ! d2 ^& }# ~, |5 ?$ V" Q- x6 {3 ?
WScript.Echo("Simulation Finished!"); |