Example of a JScript
! r: v# S( b! F+ Nvar vbOKCancel = 1;
! X/ B; \2 s) i) Q" t* Wvar vbCancel = 2; # ^( _" o% ~7 I) X* k, x/ ^
var vbInformation = 64;
. I* j8 I1 {2 ]* m! N. G' _var Finished=false; : `* i# {' d; w: t
' v7 t' v+ p3 x- z# mvar WSHShell = new ActiveXObject("WScript.Shell");
- s2 b W8 ]+ u+ }
5 L- h2 B( f* ^, L9 ?3 mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 C- {- @: ^( C& \. M* f9 Y
% o% x8 J X1 z. Csimple.SetLicenseType("Runtime"); , A4 @/ G0 m/ `1 \/ u3 k) m6 A
1 H8 z# C$ x& a8 y& Jtry
& t# D. V2 [ F" a! f" d* x6 N{
* B/ a5 b! F% r* e+ R // Enter the path to a model file!
6 m/ c1 z, _& i* h simple.LoadModel("C:\\Models\\Test.spp"); * h6 i; j2 Q5 h5 O4 G+ k3 I
} # Q) E% G {" f: S) [
catch (e) $ I" N( u& o0 c% x1 b6 t+ g" J
{ 4 k# x; G% I7 j' Z2 h, y3 R; n! T
WScript.Echo("Could not load Model!");
0 G( B; U# }8 q2 P4 |7 k WScript.Quit(); ( C# M- O* [2 c6 i: x! {& y
} 0 i7 Z. w$ z' m' W
: K# v; p- j- G& h/ y
try 6 l( ?4 A: n9 B
{
1 W0 J& {' ~, Y, s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( g4 S+ p/ f9 @4 h$ N& i5 R r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' j! \7 ^! |; p9 S if (r == vbCancel) 8 q7 K( d- [5 t4 n* O/ T0 p6 m
{ ( U8 Q2 D7 c* r
simple.CloseModel(); - Q# d! p; c; p2 X, D
WScript.Quit();
) N0 K& q& ~! c4 x% ?9 _& m. f } / B2 [' K1 E0 ~2 A1 ]
} ( k$ w8 k$ L6 l( s& q" y% |! H
( }' i! d: z- H6 f: C' psimple.StartSimulation(".Models.Frame.EventController"); ' p8 l" U& n4 N* T4 q2 U7 w
8 P$ z8 M& M# j
if (simple.IsSimulationRunning())
]( n: `- }# L2 |: P WScript.Echo("Simulation is running!"); 2 r$ A2 }* C5 h9 Y( i
3 d2 H3 [( i. m. d// Wait until simulation is finished
: r& E h) y6 K/ ^: O) Wwhile (!Finished) WScript.Sleep(2000); # O3 S% Z$ Z V5 A: {
+ c' ?& ~% f: s3 p6 @3 f5 b
simple.CloseModel(); : f5 [% O' `$ t0 C/ R' ]1 U
simple.Quit(); ) d( w, n- O- X- D/ U |2 B3 w
WScript.Quit();
6 M ?7 W( h7 R+ Q- X; T$ Z- M 2 w9 `. {4 x. {# u8 u
: N( {8 s+ k, G, U( c% Tfunction RemoteControl_SimulationFinished()
- S" }2 [1 ~" ^+ `% j! }{ 3 E' ]& ^; S C9 M- I
WScript.Echo("Simulation Finished!"); |