Example of a JScript # p9 j- M4 l. y) F1 v9 L( F
var vbOKCancel = 1;
* u8 v* a/ W2 {var vbCancel = 2; - E2 x4 s' s- R8 E6 [
var vbInformation = 64; * m* u6 q: K! T8 l/ L! D$ U
var Finished=false;
1 V w0 v5 Y* y2 u* p/ X 5 w ~0 D( J1 p' L, d: r' r
var WSHShell = new ActiveXObject("WScript.Shell");
8 p( q5 k# `; Q- y x" Q 8 ?" f6 @ m- P. u0 ~& l0 T* U
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ L* |) N# u" A& f. ?& r M; G
2 S, _. v. U8 @3 p( _7 w/ Q7 \/ usimple.SetLicenseType("Runtime"); $ C' y- {- `2 z+ _5 S
. K3 ?" e5 q Wtry . t! H' `+ ^. V0 `6 i8 ^
{
% C# _7 s0 h V* @/ t9 o: j0 B) T // Enter the path to a model file! 5 B# O `5 \9 }$ w3 y2 r+ O! d. [
simple.LoadModel("C:\\Models\\Test.spp"); 5 t% v) w6 ^" r W, F1 O
} . S/ \# e, n3 z) {
catch (e) 7 f1 y, A9 A2 ]! w* M# k# O
{
' s( D! Z3 Y7 q WScript.Echo("Could not load Model!");
; C/ d3 M C& I1 @ WScript.Quit(); % E: m% v; O" a
} / }: B) O. Q( T9 a, B& u7 K4 y* Y: o
, c D0 p7 k. z% A! u; b6 t6 ~try
' Q3 @+ s7 Z& p$ [1 g{ " y7 H) }" Z- Y4 Q6 w- F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 ]* ], R1 J5 a- J r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , A6 Q8 @7 B: R
if (r == vbCancel)
9 y0 c3 O& [5 F {
5 q- S' n+ m0 O: i; ~ simple.CloseModel();
! Z5 U% v8 C; W) i9 I* R/ X WScript.Quit(); * R' b4 J* R" u* j5 _9 G. Y
} & b1 ^3 V c7 z4 w/ A% s
} - z6 c* |' P3 S9 i2 ?& ^; J
1 v: x1 |5 p, X/ B! ksimple.StartSimulation(".Models.Frame.EventController");
* _. B. O! A9 N: d \. }8 {
8 k: P1 {7 D2 P9 Q; wif (simple.IsSimulationRunning())
0 i h+ F" v+ j* w y! |8 r. L$ [ WScript.Echo("Simulation is running!"); , {7 N9 G" R7 s
) v3 w: R0 B0 c! e- k7 m( U// Wait until simulation is finished
% Z) w( I% r+ d+ ^( @0 Twhile (!Finished) WScript.Sleep(2000); + z" T/ [/ V+ T% Q+ L& i% J1 `: }
' Y) X% p% n, G5 U, Q8 ~$ U
simple.CloseModel(); 1 g y2 s" q2 `3 V! ]
simple.Quit();
( u) A5 F6 {7 `WScript.Quit(); . H$ a8 E& {5 @. }+ V
3 g* f( ]8 z2 `+ K- K7 j$ @4 C
- P+ L' q6 s* Z, @function RemoteControl_SimulationFinished()
{. v! b+ e/ }5 x5 o$ s! s2 ^+ c{
$ u: j( r8 U, x6 r5 N* B WScript.Echo("Simulation Finished!"); |