Example of a JScript
+ D4 z' j: ? h8 S% U$ D0 a% Q; M8 p" Wvar vbOKCancel = 1; 4 f. @' |6 k* L
var vbCancel = 2;
) d- `# I( Y; U9 bvar vbInformation = 64;
7 E4 y# w* r1 S3 Xvar Finished=false; / G" U* t& c" G ?" G% `9 C4 d
: m! D. j3 w, i9 w4 a, ]var WSHShell = new ActiveXObject("WScript.Shell"); ' |1 B. P/ c+ e/ a
- t1 h- Z+ k1 [$ ^+ M$ \% lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . y6 s+ B4 K% C& ^
* ~7 o1 N. q" I) ^+ \8 g
simple.SetLicenseType("Runtime");
8 n( W, Z' ]# c' h
1 f8 f: e: Z( Ctry ( O5 ]3 J- e, X6 V+ O' j# Y
{
0 B0 l; R: S2 D5 r% { // Enter the path to a model file!
) N {1 s0 k9 m" ^$ E simple.LoadModel("C:\\Models\\Test.spp"); + W2 M" s0 z0 b9 O. Q8 M6 A
} v7 Z" x. q9 E4 q$ F+ Y
catch (e)
- s: C: b' l. G$ G8 j( d4 I! \{
' Z9 e$ n/ y+ S' |: G$ m WScript.Echo("Could not load Model!"); , V" X6 B1 a i( \
WScript.Quit();
& }% g$ e8 T& X5 s8 E}
. o7 N: k4 A% P' v& u
& y Y. Y( [% z2 z9 itry
7 R: E* N0 \7 l: D* T{
, x' n/ S% r6 C4 g* _9 \ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / t, q! R! A9 r5 g" C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # K9 M9 l3 p! x. d2 U1 o
if (r == vbCancel) - V4 T/ @9 r" G* E. P& X
{ 0 B. q5 \/ s C9 [
simple.CloseModel();
* W7 m0 ~/ g$ x2 `7 o, ?" L0 s WScript.Quit();
# @6 O5 G7 T. F$ s, j4 a2 H# ? } 2 H5 |' K0 d# N. a8 _
} * f( I9 h5 e1 r1 ~) X8 d2 J2 D
9 I( c- D: b5 X& f/ z; nsimple.StartSimulation(".Models.Frame.EventController");
- |. E0 @* T4 V: Q8 s2 y- {; o
, @& m8 W# @) Q0 q) fif (simple.IsSimulationRunning()) * r: h% C; A6 f' S
WScript.Echo("Simulation is running!"); 9 x6 H8 \% }8 g$ T' @9 M
7 @1 u" Y5 j5 i h6 R// Wait until simulation is finished
4 M! P% }) b) c9 l5 Nwhile (!Finished) WScript.Sleep(2000); 3 k6 Y3 b. a. u
) y7 v8 L2 Y" q2 n+ Y! M' b* R* b
simple.CloseModel();
! F; n' q7 `; g2 {simple.Quit();
4 k* v( K4 |, @1 YWScript.Quit(); ) t0 G& P9 a, F- v" ?& k+ C
. k; X( ?0 ^ V) V1 w( b6 y
8 K! m( o7 B5 lfunction RemoteControl_SimulationFinished()
, s: G8 z) z$ _( q/ S4 @) O{
! n7 u/ n$ ~' l: D0 r WScript.Echo("Simulation Finished!"); |