Example of a JScript ( e: M- x$ N6 [6 N
var vbOKCancel = 1; : Q/ ]' D: ] B( Y: ~) M
var vbCancel = 2; 5 _0 f$ J N1 m
var vbInformation = 64; 6 |, x9 U/ m5 j) e4 C
var Finished=false;
1 [0 u; P! L* `! ]) N
9 W2 l7 h }7 ]' f" v( F$ Tvar WSHShell = new ActiveXObject("WScript.Shell");
! J' E6 |, Q9 f r% ?* D ' `! z6 h) b7 Z' v$ x7 I0 |
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ c5 W4 l1 \0 v1 {
; B+ Q4 ?' G5 |1 A4 ^& ?* P/ e0 U! }simple.SetLicenseType("Runtime");
3 |, n" s _' i% p$ A( z7 W 8 a) {+ k* p2 z# ?
try 6 E: E/ R; N5 y& d; }8 j
{ . s( G3 w4 |) o- o0 @
// Enter the path to a model file! 8 S, A; Y* O! S' j5 U
simple.LoadModel("C:\\Models\\Test.spp");
9 }/ U/ f( c" M- [} ; d" P, _3 d" `# q5 k4 K
catch (e) % W% k. D( s$ @( Y) B
{
$ @5 _& A1 `$ y" u* y! ` WScript.Echo("Could not load Model!"); ! C- }$ v: }. i8 t; Q# H
WScript.Quit(); 4 {. Q, W( A& ?7 t2 h* l' P
} " x: i( N% s; k+ E! C1 ]
5 j Q) H* i! z) f* X, X' mtry
+ ?, z5 G f6 g) ~4 i2 G{ : ^% _2 Q+ d H# Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * f) F4 R8 j$ C3 X! M/ x0 c7 p# a2 h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " |6 S! H9 r5 ]$ b# f# n
if (r == vbCancel) 5 e9 C1 D' V9 R9 `! H' a( J% r
{ ' O7 X- K6 o3 m2 p: j! }6 ~$ m
simple.CloseModel();
, [% o" Z W- J% P) ]" x WScript.Quit();
, ]2 `2 x+ b2 e7 Q( X }
I4 e& O/ {* c9 M; m} ( ~& K4 x6 G) E+ ~4 l" A% }
" Y: T7 S1 O2 h4 m; u. R( S& F
simple.StartSimulation(".Models.Frame.EventController");
2 C, a$ D$ U5 U; ~ ?$ v9 L
3 X' L( f0 w; Y+ J2 Z; i4 H' K% D" Rif (simple.IsSimulationRunning())
5 a m- f* x7 M, h1 Z9 d" X WScript.Echo("Simulation is running!");
" {, Q8 y* z3 Z; ]0 V# g# y/ [% a 7 M/ q( f" a! p/ `- z
// Wait until simulation is finished + `. g) @) i) K1 ~+ L2 Z8 p' V7 S5 a6 Q
while (!Finished) WScript.Sleep(2000); : B$ Y1 y' m+ X* a7 e
. s, S7 v& N9 x
simple.CloseModel();
; l" v" ?2 H2 z' Tsimple.Quit();
8 S' {0 A: Q* }" }( ?' l3 E Z& w3 XWScript.Quit(); ! v7 s" @- j" |1 Z! a1 I
) O# T! H j9 U' G* u7 y7 O1 x % e i s' }* }; W& X H2 a
function RemoteControl_SimulationFinished()
; n. J" {9 c. h( Q* R0 H: w{
3 B9 v e7 X- n( d& d/ [ `8 U WScript.Echo("Simulation Finished!"); |