Example of a JScript
, D4 ?8 E% w. @$ D3 o( kvar vbOKCancel = 1;
9 P: g9 H: o/ J3 nvar vbCancel = 2;
' `$ F9 ]0 o1 P1 N/ @) p5 evar vbInformation = 64; 6 U5 B% I! u. q
var Finished=false;
% ]4 `# ~" C9 X5 A' u; P
, M$ o& e$ e& L4 ~$ A- _; mvar WSHShell = new ActiveXObject("WScript.Shell"); 5 h; r$ j$ u& ^# W! r
0 w( o7 N( H" C- j* j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) b- b4 ^. X1 p5 z% P+ p0 I
4 w; P( T/ {: {8 S n5 N- K! ~
simple.SetLicenseType("Runtime"); 0 q( B& ~ G2 b( c/ }( ~
4 f7 E j/ M* Y- }' u: e1 q" qtry
$ O% A' x& R7 \* g{ ; {3 U! `6 [8 x) [. A0 b
// Enter the path to a model file!
! \9 u( m" p2 U; }9 P% ^: m simple.LoadModel("C:\\Models\\Test.spp");
( Q; i9 u6 i3 N7 }3 l3 v& @* m' P} $ W$ v; i6 }4 K S
catch (e) ; g$ F! q- S) y. L5 v! o1 w
{ - y y8 B! {+ {4 }. R( Y6 k
WScript.Echo("Could not load Model!"); ( ]7 I5 H- U Q2 I/ B
WScript.Quit();
" O1 a* `" z- M- ^! k} 9 H0 e, ^8 u. Y: A1 F! d
N+ j- l- w. \& D2 I. q* k: B
try
3 n1 q2 O& {* w9 W{ 0 A* k+ Y) F. D% N/ x$ {
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. e8 W, L2 P$ k' E9 j' _* d. c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ B; d) i* Z. |- _8 i3 x3 j$ N/ e if (r == vbCancel) ; q, T& \2 a' K' d4 o+ a
{ 0 W Y5 F0 e' l3 g" n/ g+ Q
simple.CloseModel(); " I8 I1 p9 u2 S
WScript.Quit();
- U: l3 E" V; d1 U } 3 ~+ v7 U6 S* @
}
& k) `8 V* r5 a% j( Y, z2 ` 0 O3 [0 q& G0 o, `' w
simple.StartSimulation(".Models.Frame.EventController");
. |; W4 G2 x6 _( ?) @, z% b. W
% x5 f/ ~8 p# L, ^0 V9 v9 _$ i! ~if (simple.IsSimulationRunning()) 0 z' d# R$ h9 N+ V7 z
WScript.Echo("Simulation is running!");
' ^9 b: a0 v3 Z7 z% `* U- s- o
8 C/ g' M1 H7 W& Y// Wait until simulation is finished
, ~$ ]2 O3 b0 m) }/ U Z1 ?* S3 Uwhile (!Finished) WScript.Sleep(2000);
" T2 B( j% U8 l8 q" [; }& E 9 s1 s! l% K9 k" q \
simple.CloseModel(); 4 ^8 \/ P* y X' ^& _
simple.Quit();
+ j& q- _2 g0 W u3 j+ C5 FWScript.Quit(); / @% T# Z& R1 ]7 d* w
( y" s+ {& d( h% ?/ ]& w
+ y- F8 P" n/ gfunction RemoteControl_SimulationFinished() ! ^: q$ Q" H7 k
{
c% y7 |0 g) z1 y" a: h WScript.Echo("Simulation Finished!"); |