Example of a JScript
0 D+ y: {1 I- E4 L% hvar vbOKCancel = 1; 3 p, @- |, `# l& C, g( G5 E6 e* v
var vbCancel = 2;
) B( Y) o/ O5 s8 i: H* S. Xvar vbInformation = 64;
& J' e+ _* m* V# b/ N+ b& t3 p; tvar Finished=false; ! `2 d$ x0 t% z Y$ d
, {) g, s* k% {" f9 ^/ s3 ~var WSHShell = new ActiveXObject("WScript.Shell");
3 R4 J$ A. b1 x2 p. L1 p% T3 G- q* z . I0 {, X7 `# \5 y J4 w3 T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / h8 I* m& e0 P3 X9 n- o* G
" D! s9 i; ~4 ~2 T
simple.SetLicenseType("Runtime");
9 ^2 ]* P0 ^( g+ g/ s' ]$ W
5 A5 [6 Z; q; J @6 Q. }try
+ y) o! Q& i( N4 @+ g; ]8 d{
1 n w0 e7 A" ^, F( n* q8 f // Enter the path to a model file!
. m$ a5 @" U7 Q. E6 R. p simple.LoadModel("C:\\Models\\Test.spp");
6 P9 Z- D, i `+ Z3 j" N}
3 B* t- y( u d4 l! Q. ?catch (e) % o/ p% W- U* d# D- ~$ `$ Q
{
. r3 A8 _0 L1 J% }0 s WScript.Echo("Could not load Model!"); ; G' _- }, s+ r7 v. \
WScript.Quit(); . G# x+ v, h8 P1 W% ^* z
} / j' e5 S7 U5 M9 a
; O' k$ l* p* ^. C8 D6 c) B0 Z' E
try
8 s1 o6 x ]& v% l4 Q8 I- F$ e" u{ ) _( @0 i5 h1 O7 ~) R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 f, y& C! }1 S% D$ B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* S( `& ?, w3 v( c; s" c7 h$ S if (r == vbCancel)
( f# ` v& S! d3 f) F& k) s {
# M" z* T- u9 T( V& W* D4 b$ ^7 a simple.CloseModel(); ' P8 N" k& f3 ^0 r
WScript.Quit(); ; K8 k* [2 L A; j3 ~8 E# A
}
# p$ F) i7 U' _7 q, G3 G} % d$ q3 ]3 @; O& V h- s% q
) p) c- ~ Y' W6 e% m9 I
simple.StartSimulation(".Models.Frame.EventController");
: E3 {, A$ X3 G* T+ o3 K) q4 E: W, G ' M& J0 n. V+ {2 \2 o) {+ E+ C
if (simple.IsSimulationRunning()) / C$ W& T$ E" R
WScript.Echo("Simulation is running!"); ; |- q' u' B# z- {$ E
* f; {4 P0 Y8 Z- ]5 r+ F
// Wait until simulation is finished + w8 h2 K) V2 M. e1 h
while (!Finished) WScript.Sleep(2000); 9 g7 N9 }. h; r0 O( y0 Z! G
: Q% v" U. n! k. c$ ~
simple.CloseModel();
& B. B6 m! ~2 t- s) [simple.Quit(); * u" H8 f& L5 a! j2 N3 y
WScript.Quit(); . c! `( _+ o6 ~
( F9 w, y: _1 @8 Z8 q
( S. A2 J% p9 O6 E: Xfunction RemoteControl_SimulationFinished() & `+ o$ |) K* i. T: Y& z, n* z
{
8 L; u2 K, N4 N7 B WScript.Echo("Simulation Finished!"); |