Example of a JScript
6 P. ?, r4 F/ l6 h8 ?; j& Lvar vbOKCancel = 1;
% I3 b* X! r, i7 W2 jvar vbCancel = 2;
# }% Q0 L1 m2 T: S4 Lvar vbInformation = 64;
3 X& O. q8 O/ X! M& X3 l$ F0 Y, |9 Bvar Finished=false; : j" {3 m* I9 ]4 U+ V
. _ H: r8 H/ l0 T
var WSHShell = new ActiveXObject("WScript.Shell"); ( ~ w* s F8 [( @4 V+ J
5 s3 Y" D( H2 e2 Z4 M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: P! w/ S/ j! u0 H
. d' ^! X8 ~ [$ zsimple.SetLicenseType("Runtime"); 5 H# z7 m0 E# O4 A) s) s7 e
0 G7 r2 |: k- M; K# v2 Y/ ptry 7 `. S$ C v3 J
{ 7 N+ V. w& [1 t7 c- V5 b
// Enter the path to a model file!
* W3 Z. Z9 ^* u$ |8 O, c simple.LoadModel("C:\\Models\\Test.spp");
. \2 V. J! i! T1 a, V) y6 G1 f}
6 v# E% \# M% A% G7 ?) a' [* [catch (e)
/ D5 x d# p9 u0 F& `{
; x: T' y/ S: _3 J WScript.Echo("Could not load Model!");
" L) Q' J8 R( h. o1 g' z# g WScript.Quit(); 7 q+ f- \6 c5 d& ?+ g, Z
}
8 `. B2 B5 j6 l$ u; _( o$ Q , a4 b, W9 t" U1 l; q" x |7 A
try
- o3 @ @) `5 z% e) L{
* s% \( R* k& L8 Q; w8 S simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 Z1 W6 x4 \6 f0 A5 T! F/ Y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! p% Z+ M9 ?" i2 `& a9 K
if (r == vbCancel)
9 u" N* `0 Z5 [5 n { ' Y( e7 q9 F- }! Y w
simple.CloseModel();
" n F; \' q) J; Q WScript.Quit();
' D0 T+ a# ~1 E8 p9 D4 W j }
0 J3 U' B5 s. T/ L9 w} & Z* h9 Y( B, m! ^+ m# Y) Y
8 m+ U0 x- _8 W0 D3 L* Z xsimple.StartSimulation(".Models.Frame.EventController"); ' |+ p4 k% T) V d
, |2 m$ p8 J* h7 r. tif (simple.IsSimulationRunning()) Y% l1 H) e, k" Q! `2 P+ {
WScript.Echo("Simulation is running!"); . E" `& L2 a" a |) h" q
1 M% M% U& s. j9 e8 b9 `3 K( `// Wait until simulation is finished 8 z$ h$ O4 Z: G7 \8 \% V2 s6 }, x
while (!Finished) WScript.Sleep(2000); * g$ L1 w- q: v& M4 J% B
- U- G; r9 w7 b2 Y
simple.CloseModel();
7 N, g7 V* K- \' dsimple.Quit(); 6 G9 ~1 b3 M8 R! @- H7 [
WScript.Quit();
& A4 ]( t6 \/ r- g S( o" A5 |* _
% p! P# w, l1 r) v3 Z1 a$ ^
* |- ^$ z5 S9 z, a4 jfunction RemoteControl_SimulationFinished()
+ z- w% U1 x) Q( n. n% h( A* U{
$ z |4 M. K( i! Y: g. X WScript.Echo("Simulation Finished!"); |