Example of a JScript : o% b- m2 @' F, ~( v
var vbOKCancel = 1; * d' l. R- F4 t# `6 _! D7 F
var vbCancel = 2; 9 b6 k4 P* z; ~4 c7 y0 z
var vbInformation = 64;
1 w) H- J- l, g, u7 ~, Y% Evar Finished=false; ) l R& z2 s& U; Y
& {9 C: I+ [ B: S
var WSHShell = new ActiveXObject("WScript.Shell");
! B; U7 s$ l7 f3 u8 Z
! J( ], l9 Q- [var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% U& u, o7 g! P$ @
! f, h& f. @/ |8 a5 Vsimple.SetLicenseType("Runtime");
7 P3 N5 A8 [: x) p5 C$ f9 o% `6 H
$ s- E9 g# O9 ]" w4 v) o" T/ etry " h, A* B' W o1 |% e; C4 x% r2 H
{ % E+ P6 o+ I w' ~
// Enter the path to a model file!
9 r/ I) W4 ?" ` a" K! D/ q& j, O simple.LoadModel("C:\\Models\\Test.spp"); ! F$ d/ l2 U& Q' D1 g) f/ I% p
} + D: X* |6 f4 o7 K7 Z+ e6 m( g
catch (e) - z3 \$ i7 N* q$ Y' b& F
{
: \9 J" n. q l' H0 @, d. b WScript.Echo("Could not load Model!");
3 \) @/ _$ `/ {0 ?* U9 Y WScript.Quit(); ' m5 P4 P, f$ s' P6 T( E* _" E. T
}
' v6 f; S3 V P5 y0 H3 a% H 3 Z4 @( ?+ b9 N7 a1 P, K
try # H8 o4 p, P" |) Q: \$ x
{
8 G: E/ x5 c7 S5 m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' x: G6 x0 K" L$ i3 g r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 5 G4 P& z; z9 c4 H2 I) `* ^
if (r == vbCancel) ; d! N) x% G; r' b
{
! t/ X# p+ H+ v: s simple.CloseModel(); 7 e6 S' N: `3 M1 L, ]. B3 b
WScript.Quit();
% T( m6 w( p& i7 w } 0 I5 H1 B1 }4 k5 z% ~& l3 k8 e
} 0 R1 U- ^9 R, B+ c/ m, ?' u
4 t7 ~( D( b% {6 Y# {! q. s
simple.StartSimulation(".Models.Frame.EventController"); 2 P0 l- h; u/ L1 V! j
. N, {1 x$ h/ q8 Y% p
if (simple.IsSimulationRunning()) ! x' J1 S2 {2 c3 h( u
WScript.Echo("Simulation is running!");
3 f& J! S6 ~9 g8 c4 ?. | & Y/ {# c( {) |0 R
// Wait until simulation is finished 4 A1 B" L7 f& e- Y6 Q5 q
while (!Finished) WScript.Sleep(2000);
, T+ M( i8 x6 `% [- l
! ^ x( c4 f5 q4 Tsimple.CloseModel(); . S" k0 [( d6 G+ L( l, q
simple.Quit(); $ l, B |5 B/ D7 X
WScript.Quit();
) c0 \% k" \- w) D7 @& c 2 ^( H7 g8 l* ]7 i1 E3 ]
; N6 T- Z& C: x. V' c& I. Q
function RemoteControl_SimulationFinished()
& ?7 i+ e: s0 Z/ Z{
8 k: {4 [; ]$ { A4 _2 z WScript.Echo("Simulation Finished!"); |