Example of a JScript
% e& Y6 a7 @2 n% qvar vbOKCancel = 1;
3 O7 t( q6 O3 d6 @" x" n# \var vbCancel = 2;
) E1 v1 b6 {. ?( O0 A9 C5 yvar vbInformation = 64; & q; h/ r |- t4 F4 N7 I
var Finished=false; & @8 k# A8 s! `6 x
' B+ g5 b& e& Q, Avar WSHShell = new ActiveXObject("WScript.Shell"); , l c( w2 u2 H& W- Q/ R
- g" {' k0 G$ d9 V
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" @$ a" b$ f" a! X3 F2 f% h- h
- h0 x# O ~9 c, V% Z7 B$ usimple.SetLicenseType("Runtime");
- t- n# K1 ^, ? c) X8 T 8 q i( H* V0 f& m: Z( t
try 3 C0 l9 a% @' A5 R. a
{ : {; g& ]8 n8 l# }* R, N
// Enter the path to a model file!
) D0 c9 R# y g5 V6 Q simple.LoadModel("C:\\Models\\Test.spp");
3 `; a7 s3 d9 q3 E}
* b* k. s' ?) {/ z" {; z+ dcatch (e) : _9 s2 b/ T- e6 s
{
- V3 T/ \1 O( y' K WScript.Echo("Could not load Model!"); + A3 w) e l- M$ |& W c0 [3 ^
WScript.Quit(); 5 R9 ~! H/ h ]1 u* s5 j
}
* K) E2 w: ~8 | [/ y ) G6 W: X2 [1 ?2 ]9 f p
try
5 ?) o3 T+ `/ k{ - P5 \# F. r) \; ^( Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" j& x! H8 \3 o6 Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + L" s; I2 I( _/ S+ @/ Z( J! k
if (r == vbCancel)
! }4 M: d8 X9 Z2 r$ ^/ ?5 K {
- C$ V+ c8 t) K simple.CloseModel();
2 O q& V: `2 i5 c' {# c6 w: b WScript.Quit();
4 ?: _. i1 o+ Q" B7 C } ' E* D2 j+ i, p% S: u
} " H# [7 F7 _3 C H8 n/ W; o
3 }5 H" s# ?$ u5 isimple.StartSimulation(".Models.Frame.EventController");
1 C6 E/ t) u! |" g, D
6 X! c, P) `- q" Tif (simple.IsSimulationRunning()) " Q9 v& \5 N) H$ @2 I
WScript.Echo("Simulation is running!"); 7 }7 x% N0 `9 F' i% O7 y( D
; x& b) l- ?0 `& d1 ?2 i9 z// Wait until simulation is finished
5 b( P) j4 S8 ~# X& mwhile (!Finished) WScript.Sleep(2000); 3 ^! N" f4 k8 X# b5 Z% ?+ I
, S+ \5 w/ K$ ~' D- _& t/ @simple.CloseModel();
* t/ b1 i9 X, T+ U( c5 ssimple.Quit(); . Y9 g' ?) C% m E K/ o' u
WScript.Quit();
/ l: v4 f/ ?7 j8 ~+ K
7 V: A6 E3 K8 f6 _$ J1 _! c' y' I
& h' X7 S0 R( d7 J+ ~+ e+ H) ~function RemoteControl_SimulationFinished() 0 @- e8 Y x+ x$ b
{ + ~2 M& r- }, I. M0 A F
WScript.Echo("Simulation Finished!"); |