Example of a JScript
, l$ Y& {8 b: M0 V# @( kvar vbOKCancel = 1;
. q5 [) H, @* fvar vbCancel = 2; & V) ]; ]% p, H, n8 t
var vbInformation = 64; 2 |% A ?1 f4 v* D6 l
var Finished=false; 6 Y0 u1 U: h8 V8 x% o
" |, ?' {9 m: W9 M2 @0 J
var WSHShell = new ActiveXObject("WScript.Shell");
$ |( [% ]8 v) p
* [. P2 X# Y2 y2 D; A" M/ hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + F0 x7 i1 T# y3 M# K* a
( {+ _( Y$ R& |: `
simple.SetLicenseType("Runtime");
) S8 r! K- O8 D" D5 u% \4 i) Z$ F " M7 R& D/ q8 I5 Q$ Q+ J
try " x/ y5 ^* |9 ~( V! T. T
{ ( J0 N- h+ i/ w! a1 O. v. q$ g
// Enter the path to a model file! % P. z& V0 Z& s
simple.LoadModel("C:\\Models\\Test.spp");
$ I/ }9 Z6 p4 w4 h6 Z6 v}
( c; H6 D0 w+ T8 Z7 z; Rcatch (e) 0 P7 s/ D# A. \, w. A" X, r& X* O
{ , [! h4 I3 H. }) Y
WScript.Echo("Could not load Model!");
! B" p. R: G. A: Z8 }" G: H WScript.Quit(); * `9 Q: V+ i3 G7 z) X
}
# J! { W2 z& X/ j+ k % u4 ?& V8 K+ j0 Q8 t% @
try
9 N0 d- s: w3 ^1 n{ 5 Q) H0 H) X& r/ \
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 U* o) G K, b8 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . `' t7 _0 V# v6 l: E
if (r == vbCancel) : h3 R0 u6 y P3 Y. O! G
{ $ M8 L3 `8 s/ ?& ?+ O, k
simple.CloseModel();
4 M" L; j$ R6 S- L5 j* J WScript.Quit();
( P/ Y$ ]0 @ X% B( q, R. q s5 q } 4 ?' L8 g% G0 K! `; z
} ( F! x2 B1 h. J: i3 d: R0 [
9 @4 E% ^9 x- v. @* O
simple.StartSimulation(".Models.Frame.EventController");
- w' x( Q5 \* u% @
& h5 C) L. D5 H: Zif (simple.IsSimulationRunning())
1 e9 t$ I. Z# e WScript.Echo("Simulation is running!"); 0 [0 \& Z" c& |0 u
! o( T: G( @3 w& m) s
// Wait until simulation is finished ' A0 M+ C( W% r: \
while (!Finished) WScript.Sleep(2000); 8 P/ N+ u$ E! I- T5 C' U1 n/ Z9 }, e
% n+ F% B2 L. ?0 W- Y& M3 zsimple.CloseModel();
) a0 N6 m/ E5 n3 p! @0 g, V" H) Wsimple.Quit();
: A; _/ C) ^" j3 [WScript.Quit(); ! Q; u, v1 j3 h0 }( ?2 u
; D+ V+ W: K3 K6 A) o
* ~8 ~; X# U* U8 y: [function RemoteControl_SimulationFinished() 6 V7 [, b x0 {8 p3 R! H: [0 |- H
{
$ D. c5 G" y$ V& O WScript.Echo("Simulation Finished!"); |