Example of a JScript
$ ~( j6 f: |3 v; Vvar vbOKCancel = 1;
5 l0 Z# h& z8 H3 y0 ovar vbCancel = 2;
5 |3 M" o5 p V) l5 b4 rvar vbInformation = 64; 3 h5 g `. x" M" h
var Finished=false; 0 R$ i+ h& n J( V% I$ ~6 |0 ?- O( U
" L- \7 m Q3 Z: m! X( ivar WSHShell = new ActiveXObject("WScript.Shell"); , s! j; V4 U# }4 S- E* J
" L1 e* ]5 q9 x; J# I" w! Y' Yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : _0 e$ w U$ Z/ ^
$ O6 L; H6 W. |2 r3 `
simple.SetLicenseType("Runtime"); 9 d7 u: e7 _. F* d- E- M* c
& B9 K9 S1 q( B7 M+ m# l, r
try
5 L0 D6 h+ `, ^# i+ V1 {{ + P# F c9 r2 x
// Enter the path to a model file!
. o, A# j% i( u/ U9 P simple.LoadModel("C:\\Models\\Test.spp"); ! R6 t, U$ X; P( r+ p3 D5 _$ Z. z
} z% B! n8 b; b v; r/ b! b
catch (e)
- P+ T, x/ @3 u( F6 N{ 3 o1 _ }5 W) A) ]
WScript.Echo("Could not load Model!");
: l- r/ ~& \! Q9 I! ^# Z( a4 y WScript.Quit();
# C$ X- w9 K5 K+ H& ?6 S" H}
: X# J! ~% U) P# |6 M
/ c: x+ D& K6 X% i4 \try
. ?6 {" s- V! V* O( D{
1 h7 h9 S+ b0 j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 b4 ^3 Y* D* E0 \9 Y% }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
I4 r6 w) S E' p2 } if (r == vbCancel)
, m7 [8 A$ |" H( R: t' A { # @3 S5 t- q) m' T% @) C
simple.CloseModel();
8 v5 [/ z, a7 J. H( E5 G WScript.Quit();
8 I3 Z+ v/ b6 w- n9 P W: _- }8 ` }
" y4 E+ p& c6 t$ d1 z ]; T}
% L8 }; W. a7 E9 t9 U, n& _" O
+ h; P; f/ s; s5 X) y; M- xsimple.StartSimulation(".Models.Frame.EventController"); & k( d' e" [. \2 ]1 @ U% L- b
* ]" H: v: V% {( k4 J8 [, O. j" k
if (simple.IsSimulationRunning())
; V, p/ d* B& }: e0 \ WScript.Echo("Simulation is running!"); ! w/ ^5 K. u1 f$ [1 d5 O
% x+ E8 c7 G g0 y' W3 V
// Wait until simulation is finished
$ E$ p8 ~) Z1 i: h2 ]8 ~while (!Finished) WScript.Sleep(2000); ' h8 |: m# l- m& n$ X, N) X+ G
i7 R+ S. O+ Osimple.CloseModel(); % A7 |7 D( a$ P2 p5 b
simple.Quit();
" I4 ^( F' V$ G! t' T" s# GWScript.Quit();
% L8 F3 v3 X. E5 w3 q
; L+ y+ r" m5 }! Z / p3 I( P$ W/ j& V, A" {8 t1 R( S
function RemoteControl_SimulationFinished()
0 t) N* p0 G0 U{ 5 q& e1 v# G% P6 z+ c" Z6 x
WScript.Echo("Simulation Finished!"); |