Example of a JScript
6 j% \; i) S- w/ K, Ivar vbOKCancel = 1; - T2 |# Y. k0 p& O- o
var vbCancel = 2;
/ F4 e4 I8 M& Zvar vbInformation = 64;
6 y4 |* u) a! J. g8 U3 q# k" Avar Finished=false; - r( l/ \! l ] ]6 M
. `7 S! j6 Q" Z$ z' j( vvar WSHShell = new ActiveXObject("WScript.Shell"); 9 w# O1 q* ?, q
" Q- t- ~" B3 Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 Z/ Z4 i+ w# n& i4 N6 V9 K1 c
$ c, G4 U& d y6 Q2 lsimple.SetLicenseType("Runtime"); 4 }* q6 t2 X$ s$ o# r3 x
& i, z1 g- f9 e, J Z: ktry ' x7 x; I$ I- l; Z. u7 ]" n
{ c% p- G: B" q9 U9 J
// Enter the path to a model file! & t% A+ c! l1 }6 Q# O. U' `2 ^
simple.LoadModel("C:\\Models\\Test.spp");
. B" b! l, P$ Z! v$ y6 ?}
$ R/ W) m3 ]6 B* l5 B$ Q& l4 k4 H C' Zcatch (e)
7 X( }; O; I: S7 n{ 4 W* z% ?: {5 p
WScript.Echo("Could not load Model!"); 3 b' D" w, [: I" k) t T
WScript.Quit(); ) Z# ]: r" N$ Q7 ^
} 8 A: U U* |; I* F2 H2 e/ d+ }# M' f
% o- g* D- t7 h" jtry A4 h, a0 s# D( H
{
: U8 \/ j7 S$ r8 ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& |" \$ c# m7 _5 _- B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 d6 W3 c0 J, o6 U9 q$ g) d$ O if (r == vbCancel)
2 A3 x/ N. ?7 { { . @/ d+ O/ d4 ]% P4 T; X/ E
simple.CloseModel();
' d6 H5 \3 r; p2 f! J+ a; @ WScript.Quit();
0 {+ {4 v" I3 b1 g* f }
) C2 M" r9 _- |6 ^/ ]' c}
: u, i+ h8 U& E( f
2 m4 `- @- b: x* j( m) n F, @simple.StartSimulation(".Models.Frame.EventController"); 5 C5 ~7 {0 u6 S; y# W6 a0 M
* s# f/ r: S! x# W
if (simple.IsSimulationRunning())
$ g; a1 Q* Z$ L: A( B' u" P. Q WScript.Echo("Simulation is running!");
! t- ]6 E( m( t ; y+ a- O2 B# n
// Wait until simulation is finished
$ x. C% o$ }% i$ w/ {" I& Ewhile (!Finished) WScript.Sleep(2000); & x7 \. W' q' n
; _5 l/ L8 X7 L- k
simple.CloseModel(); . v- q( G& m9 R: o1 G. T- z1 v7 R5 x9 u
simple.Quit(); ( n, R2 j) p, g8 @
WScript.Quit(); / x+ {$ e. {) h2 ~ A
0 O+ n. s+ b! [+ k$ `) [0 w
7 g4 k! ]) W5 p& q8 efunction RemoteControl_SimulationFinished() ! [7 f( C8 u) |0 H9 a
{ 2 t' N. o3 N. w7 O3 |( S
WScript.Echo("Simulation Finished!"); |