Example of a JScript
% `( G; d6 d6 q) _9 p& Evar vbOKCancel = 1;
% Y; R0 k7 Y1 J8 Z, nvar vbCancel = 2;
5 ~. h! @" |9 ]) E- ?var vbInformation = 64; * B. d, \8 M! |$ N5 ~
var Finished=false;
* Z" X, m* j4 `/ u. |6 a i
# a ^% H9 v( [# z+ k; zvar WSHShell = new ActiveXObject("WScript.Shell");
/ A5 Y W+ l/ Y0 ?
! s( A5 T1 l9 J( A" F2 ~0 f! Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 G! i$ l: p5 \ " w7 [: g. s! Z% Z
simple.SetLicenseType("Runtime");
1 Y# O+ c9 y5 @& G7 U% d! ^
- P0 D& w3 t ^5 L* L7 ytry
* j( ^! B2 Q# y. w8 D. G P{
3 l5 F5 l% M, _3 a; O+ P // Enter the path to a model file! * p5 Y, s0 W9 P; P1 E! m& p3 [/ y- w
simple.LoadModel("C:\\Models\\Test.spp"); : ` P' k1 s2 y; {$ ]0 c- o
}
. b+ O. ~; \1 [% e! {- dcatch (e) & Z6 w* I) L5 \3 q9 S
{
% [' H) U. I0 A# ]$ {! d; Y; A' Q+ s WScript.Echo("Could not load Model!"); 1 N. @3 o: p; b4 p& q
WScript.Quit(); " R$ I d/ D6 E
} ' c$ g% G5 o2 u
' C, V: \& Z( X7 c0 I( G6 jtry 4 I0 C, n5 r9 y1 R# Q7 D' F ^+ q
{ & s, y! u4 ?8 f: i) v" p. \
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: n) E' E/ F# m% C% `4 J. z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. ^2 C0 S9 \$ Q& Q. @ if (r == vbCancel)
+ Y& M! R- N( P) f {
" z, }4 {" j S0 j! c( G T% R K simple.CloseModel(); 0 Q+ v2 i: @- D
WScript.Quit();
{) U+ ]% b5 y7 Z! i } # x# P9 \' f" R* v
}
* g5 X2 z8 n, |. S- M5 d1 Q" n - r% e. D- G9 D5 E- z
simple.StartSimulation(".Models.Frame.EventController");
- x6 j/ |3 }/ D% d 4 V& w. _4 i: B: {: f9 ~
if (simple.IsSimulationRunning())
: B% G. D. k* B% | WScript.Echo("Simulation is running!");
, q x; G7 \ N e: g
! \7 L: E5 V. l$ a' J6 V// Wait until simulation is finished
8 A% N5 U5 {* z1 s5 B; c( mwhile (!Finished) WScript.Sleep(2000);
" L/ \ Z- c4 [' b" ~
: h, l, N* [$ H( U) D$ Ksimple.CloseModel();
8 [% X% }6 j7 t$ \simple.Quit(); , O2 o/ z. R/ Z( ]5 @0 N
WScript.Quit();
- @; r- u# w) e0 i
( x' W/ R5 \6 ^ g * A* F8 F, ^, T$ S
function RemoteControl_SimulationFinished() ) _) i0 N% b- |1 _. t
{
5 |) l" B: Q' H WScript.Echo("Simulation Finished!"); |