Example of a JScript ! m+ I# E4 o( p$ @- f: w1 W
var vbOKCancel = 1; ; g/ V0 R3 } `9 z0 l. L
var vbCancel = 2; 8 P2 h1 T% y* n7 [
var vbInformation = 64;
: u5 n6 D' I7 m* V4 G' U# N; bvar Finished=false;
& @0 u9 a1 V5 Y9 X 7 A4 H; @1 B( O
var WSHShell = new ActiveXObject("WScript.Shell"); . [" ^. P* T" Q2 o
+ p: v( a: Q$ f5 u6 q' `9 q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 R& g* S& d% v2 i, W( ] * s5 G- B; {1 }! w0 i0 e
simple.SetLicenseType("Runtime");
# g( s- a: u& K2 N2 x8 N* Z! i
9 e3 h* ?0 g: m' ztry
& ], j$ _# v% P0 ^' Q# y; z% ?, U f{
$ @ L) c. ] ^. D, Z, p) Z* p // Enter the path to a model file! " ]3 H/ T1 A4 ]* P: ~ S. k+ @
simple.LoadModel("C:\\Models\\Test.spp");
6 h9 ?; h( R8 M3 R$ N% w/ t}
( U* p" O0 \* v" [catch (e) & ]# S, m/ B3 a
{
; I, r' n& Z& V; i6 z7 t WScript.Echo("Could not load Model!"); $ T+ J- m/ _4 {- ^0 }% Q( A
WScript.Quit(); & _' C7 Q$ T; w b9 S9 x
} U' N9 g& Y: {4 x. N, P
& C+ i9 ?, n4 j9 F) C
try 6 g( [' C+ K8 C# ?( [; m/ v
{
! Q" w+ T" _+ [- l9 b9 F$ f( I9 U2 w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 |- @ C9 h- s1 L% S9 t+ V* } r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 Y! N+ g% }1 z9 }# l$ K
if (r == vbCancel) $ Y) F8 ^( I, L. o+ r- R
{
* k3 c7 l0 h4 j simple.CloseModel();
- E$ L9 q/ h5 V3 ? WScript.Quit();
0 _* W) A1 d- a2 l4 [/ o }
# d; K- W: y( R% L7 v' ]} # h ]2 a! @0 R& S1 G' T" G6 c* A
. q8 G" r: ?9 K0 E% m7 O
simple.StartSimulation(".Models.Frame.EventController");
: X$ W7 U: I4 ?6 R/ C9 m2 C / h# w/ U& g" i; h2 z! |1 |
if (simple.IsSimulationRunning())
( \$ Q B+ z( x2 ` WScript.Echo("Simulation is running!");
' k- c* w# H6 [6 u$ x% v
+ ^& [, p1 U- l9 V// Wait until simulation is finished - a4 n" T4 S, n" I% s
while (!Finished) WScript.Sleep(2000);
' p6 k& @8 A3 e' a$ t. }9 W8 Q 1 ^' m& Y* E! J$ k9 {
simple.CloseModel();
7 q' x: T- N1 B- ]6 rsimple.Quit(); 7 e9 [% P* ~" E; F, J8 ]& F
WScript.Quit(); $ o& z1 N, G2 Y# q8 ]
% a/ w, j7 |2 t+ v/ z, K( `& Z
. E$ L0 Q" F) J" |function RemoteControl_SimulationFinished()
% I/ {+ `$ D' t: `6 A" \{ 0 S: N/ p2 P, N! j
WScript.Echo("Simulation Finished!"); |