Example of a JScript
& \+ K* z% y' v! Y$ T+ wvar vbOKCancel = 1;
# N: V+ @6 A( d1 h2 ^# E4 fvar vbCancel = 2; : Y, H7 k n4 P6 Z4 u& [/ w4 A
var vbInformation = 64;
, ?4 {9 G8 i. B! V' W* ^var Finished=false;
' J% k+ J7 \8 T& ?; l
( u1 w; M" G" J( e2 h, N5 u4 s T. Wvar WSHShell = new ActiveXObject("WScript.Shell");
9 L3 e5 c6 j/ f+ J$ L4 Y" Q, F , d# X6 w0 p& i! ?& A4 U0 a
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; p) ?" q# v1 U% T1 r6 j - ^+ P+ I. M! ?
simple.SetLicenseType("Runtime"); o2 z% _0 J, h1 G( ^
7 O, D8 ^8 X# Btry # B9 r [$ F8 _1 ?
{
. A5 s5 t3 M: d // Enter the path to a model file!
" v" i7 y& B4 y- I- z- G/ P, J simple.LoadModel("C:\\Models\\Test.spp");
( K+ A( b# Q @, B) l7 Q V}
3 s# u3 i, r9 V! v+ C! ^% ]2 u9 `catch (e) . ~, m+ t8 `9 u: Z8 h
{ ; O2 b7 j+ y- \. J0 V; l
WScript.Echo("Could not load Model!"); " Z4 N! c# ]# Q/ o# w
WScript.Quit();
f6 h0 Y) m' e} ' F/ |2 \, L& r( H: n# m) d1 q: e
0 {5 Q+ L* I0 Q wtry 5 U) {! h( k. c) e4 }! q
{
5 \: w+ ]: {. N7 N x& P3 h9 O simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . ?# w( ~) ~! y5 l5 l3 o9 G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); n% v- l' I: O
if (r == vbCancel)
( [$ J8 E2 i# V" d { ' z5 a! u" v! U: w0 P* t) D
simple.CloseModel(); ) D1 S2 f/ k* p0 p. W* w
WScript.Quit(); ( X- l" x: `, n6 |
} - }1 F: h+ O2 `
} % }7 A" ?$ \' h7 C0 n- r
/ H4 I% e( h% G0 ~* Wsimple.StartSimulation(".Models.Frame.EventController");
z3 b) q& \, v$ w 3 k$ F: N+ F6 @* ]# l* s {
if (simple.IsSimulationRunning())
, X/ B/ [8 b* _. d" f WScript.Echo("Simulation is running!"); . X& ?. U- N1 x I
1 U0 b* @- _+ j) ?) W7 g
// Wait until simulation is finished ) S9 Y2 s5 j3 \0 S
while (!Finished) WScript.Sleep(2000); 5 s+ j, I$ g- T$ r
$ r& O e& c5 H* ^simple.CloseModel();
+ I/ D+ j8 ?- Qsimple.Quit(); 0 s8 e* N9 q/ }5 m
WScript.Quit(); 1 q) D* A+ A% t, q# Y! t8 w$ |
H9 p& V/ E% b" ^) ^: i) \ 5 z" I" e* C* p5 ~# s; Y, M
function RemoteControl_SimulationFinished() & p9 U4 r4 _, T7 Q; h0 G
{ ' v$ J. g* q2 n- a* o+ W
WScript.Echo("Simulation Finished!"); |