Example of a JScript
6 {, o9 [. ]3 ?8 Y1 k& p) G* pvar vbOKCancel = 1; ! z6 c! R3 t, @0 X, k
var vbCancel = 2; " n4 D5 ]: U% ~1 r0 t) t& h) b5 D M( t
var vbInformation = 64;
3 B0 K) g3 M5 s- a& {var Finished=false; ( q) U" |, W7 N
: z M8 y0 q0 H# j. a/ hvar WSHShell = new ActiveXObject("WScript.Shell");
& o) q2 W) T( L$ r6 F0 y
8 q3 M; i! P7 ^% W: q: W8 Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! O# l6 ]- k9 [
! x) z3 b' g! @
simple.SetLicenseType("Runtime");
# D! |: j0 N* V# s& t/ E! e( G/ ~ ; X% Y$ M) r7 c5 X, ~) i, C) _
try % G |4 I. }0 q" t; w# ]
{
$ s0 N0 m5 N) ^( X; m3 G // Enter the path to a model file! ; z, j0 l0 R: c
simple.LoadModel("C:\\Models\\Test.spp");
3 i* H3 h6 X6 S3 @+ Y0 s}
' a1 @8 d2 W0 |+ J. d7 |catch (e)
3 p- Q6 R7 x+ _+ R/ K7 S* p! v6 b+ R{ 5 d% r# S2 u& k7 ~2 t/ s, x
WScript.Echo("Could not load Model!");
8 T" i1 j& x- e8 Z1 w C! x WScript.Quit(); 3 N* N( c8 y% w; Z0 N& X3 |
} , _% S0 d0 F: J+ P7 u
$ o: ?2 ?' B2 n/ S' T2 D( q5 btry
( n! g W7 h5 S0 s. J' `{ 2 p! V5 V' p# l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 t* G+ i$ I0 f r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . b% \* {8 b2 }6 Y7 U8 i* p
if (r == vbCancel)
4 D& S q9 p [( S% ]/ i { ) V/ p; h+ S+ m# e
simple.CloseModel(); , ?5 }5 X5 E& X
WScript.Quit(); 6 i! ]. F1 u# ~1 y
}
# c8 }5 `8 k6 B& [6 f* h}
" O5 z2 W5 w4 h3 f1 F0 B- p& K : `# W$ p3 P [0 K
simple.StartSimulation(".Models.Frame.EventController"); ( g _; g2 {- k: U: O3 F( Z
$ @" N4 x' Q) L0 i7 X8 O
if (simple.IsSimulationRunning())
) S/ m6 u' r; w WScript.Echo("Simulation is running!");
' g: t" @% K8 E
6 H) c1 r% |; ?: K1 v// Wait until simulation is finished
% R- A Z, ^/ @# H; U5 Owhile (!Finished) WScript.Sleep(2000);
! V& r+ x/ d. k0 c! J( O 4 G& ]) W4 P0 a( A5 v7 h: f
simple.CloseModel(); / {( j3 y( E' ]# R0 J4 }# h
simple.Quit();
; V) L% [- S$ DWScript.Quit();
( h* e% \4 s$ F # |9 P1 f% a* B+ z# K5 q& b
9 u4 A1 b$ t( M* w: z6 i2 F
function RemoteControl_SimulationFinished() 7 u7 L, R- f' I7 u
{ & @- _ k' Q g. Z- b
WScript.Echo("Simulation Finished!"); |