Example of a JScript ; Y. \0 U3 C# ]4 U; L
var vbOKCancel = 1; 9 q G* ~$ f8 _7 x! u9 _; b
var vbCancel = 2;
" S2 X& S0 l' X! v( W/ a8 tvar vbInformation = 64; % s, m# w7 Y: M0 a9 X% H
var Finished=false; + a0 o; f' p+ t5 h6 }' |( R
# t0 H: [& Q! C5 O+ U) B" l, v
var WSHShell = new ActiveXObject("WScript.Shell"); % ^; r) J' o( M
3 G E/ s2 b6 j5 F. w" e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & J, N* P& X: M& v: Z# E# k
! u6 F0 ^9 ?2 s5 w; F* v0 Z7 o2 w
simple.SetLicenseType("Runtime"); % f1 X4 a( A" C3 I4 [& d( g- J
& p/ M! h2 \/ h+ @5 L' Qtry
4 C1 h8 K2 M6 L# u{
0 B! e9 }6 ~) Q9 X" c. z2 i/ Y // Enter the path to a model file! % G k% v5 @' S
simple.LoadModel("C:\\Models\\Test.spp");
1 Y N) r' |+ b$ ?& e( e% s" {} / q5 n; b/ {/ d+ L# [; L
catch (e)
' N; {3 H) P7 B, u{
% |! e5 b1 [, P WScript.Echo("Could not load Model!");
( A5 t7 c4 B" {) V- L/ I; I5 C WScript.Quit();
6 ~, [3 C- I; z T0 x}
$ x' M9 \ b. `3 H1 K( a
/ o3 K7 J4 Z# {) B. u2 }4 Utry ! l6 j3 s. n! ?5 h1 L! z8 r
{ : w) V; J$ ]8 `& y" J1 R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & {0 T5 @. ^! v+ b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ G, N+ x% S1 V$ ^9 T. x# z6 q, ~! B if (r == vbCancel) : c7 [' ]9 R! \7 w. t
{ : S6 x$ G2 u! O/ e' x) {
simple.CloseModel();
3 t; r7 P% T4 l WScript.Quit(); K% s: ?# u# u. Y) Q) _, v
} 8 w% m& W; {# k! Z' b. X1 M z/ M
} 4 t3 t O8 h0 }
8 ^' z. e2 R: P0 W
simple.StartSimulation(".Models.Frame.EventController");
1 a6 S/ y/ Z% h6 v u# W; G ! }/ k: r4 P0 }- d6 p
if (simple.IsSimulationRunning())
! z0 P1 ^9 Y" T9 f WScript.Echo("Simulation is running!");
/ f8 w2 G. e) b {
2 a1 y& \4 K) m* ~4 e// Wait until simulation is finished 9 y, {7 D$ g% |
while (!Finished) WScript.Sleep(2000); $ V7 |+ m$ [9 T( t; @
6 i+ i: e# m( M8 Ssimple.CloseModel(); # b8 |, W8 \/ @. D1 k. j
simple.Quit();
" U7 j0 T' w9 w8 R" `: w+ M; T0 K% w, UWScript.Quit(); " h5 q6 T$ [1 H+ Q
' b' K- G. P% [6 }5 M; {) a
g& ~2 p% l: L7 t+ Q& D! ^ ]" D; |
function RemoteControl_SimulationFinished() 7 q) h: j k+ H
{
) a7 A h3 g4 u; |0 e WScript.Echo("Simulation Finished!"); |