Example of a JScript
& U# b) `- q* \( A6 P4 t4 ]$ @& U5 ivar vbOKCancel = 1;
! g& i- S5 B5 y8 L6 d5 ~var vbCancel = 2;
; J0 h, @% n+ l- ?7 M6 D- g8 tvar vbInformation = 64;
% E- n0 k4 q1 n/ yvar Finished=false;
, q) c6 W6 b. ?
% V" A- z3 D' B! \var WSHShell = new ActiveXObject("WScript.Shell"); 0 n+ n: ^! ]; u* A: L$ O5 y4 m
$ M6 w) T9 m; s5 C+ R7 M2 |, y Y3 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * ^2 n- R! j; q) ~. |1 \: S
/ I6 f0 s, a A; l) K* t
simple.SetLicenseType("Runtime");
6 n6 z" v1 _* \) V. u( a$ @2 D% h. G & c$ x4 k& k1 d* X
try 9 F( i7 D) N# B6 }' O
{
1 K2 B9 R4 i5 u3 M // Enter the path to a model file!
& u* u/ r; ~" a6 u6 x, Y$ K) v simple.LoadModel("C:\\Models\\Test.spp"); 4 n; h% y! O3 W1 `8 n5 C0 s8 d
} & r6 Y4 L {( A: k/ g" T
catch (e) + k" J! {/ Q" B# k
{ ' s' r4 ^, {! }. s, U; ?
WScript.Echo("Could not load Model!");
* l: u/ d1 ]; B9 S* m, N WScript.Quit(); + x9 j9 _1 Q x; ~" m0 f
} ( H9 [6 [. n8 E3 u
4 N$ _$ i3 |3 b- y; Y' K; utry 0 B9 s( u r- Z! n a8 r# F
{
$ A: { C6 i/ ? simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . ^3 d+ O. ]' |) |
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& [2 U+ g# g+ H& L! `: j if (r == vbCancel)
0 @# _+ `: z; J3 g6 t/ o" L! N1 T9 l& I { , ]! ^+ g* `3 Q( V
simple.CloseModel();
" o9 P; n% r* p+ `: y: Q' C WScript.Quit();
5 r+ q' m9 k& m& h' Y }
% z" l9 N# H! P% T1 b- k}
6 j# J# Y3 q! U- w$ x* D4 V
( D) y, l; Q& jsimple.StartSimulation(".Models.Frame.EventController");
& F# x [2 D; j ) Y' X8 @) J d8 B$ c
if (simple.IsSimulationRunning())
$ f" K2 p8 l. N WScript.Echo("Simulation is running!");
4 a6 V; \9 {; ~1 ^ ! m& q, z) X$ G8 |
// Wait until simulation is finished
: _/ v% Z/ ?% k! {# l$ Rwhile (!Finished) WScript.Sleep(2000); & N. t; F E0 t- _8 C( Q8 ~, j. Z
, k/ s z' t, w/ v* lsimple.CloseModel(); * M* I1 ~4 C3 A% H4 f! g
simple.Quit();
! H1 c; j+ V' o* @WScript.Quit();
$ {- r! X. O+ V5 r2 K
; p, Q3 ?0 K9 ] 2 Z ]$ s6 a( {$ E7 e9 A+ M# x N
function RemoteControl_SimulationFinished() & z' D; K; g$ f8 u
{ ( u) d( }( z$ B) l& j. w
WScript.Echo("Simulation Finished!"); |