Example of a JScript - @6 z0 G" D# p
var vbOKCancel = 1; 9 Y) U& c# D( e% N) K
var vbCancel = 2;
+ R" G2 e/ D. x& K8 J" b7 Dvar vbInformation = 64;
+ Q) ?/ [; t% C: \6 Yvar Finished=false; % X" m2 ~' d1 |+ o" }
/ S9 G% ]+ }5 ^- F! \
var WSHShell = new ActiveXObject("WScript.Shell"); - r3 Q& r: R/ d( o
8 {' H7 w6 g- N- \6 Zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , x4 N* v' S9 _% `+ Q+ f$ m% X
: ?/ C6 F# e9 n4 u9 l- D5 S
simple.SetLicenseType("Runtime");
" o" t! W9 V. t( E. Q* E
* K6 y f1 |' F( Q: ` o6 Q0 d9 \try
$ `8 e. C; I# t{ " e5 v# n. w$ X/ T/ y+ q, ^
// Enter the path to a model file! # m8 i j! j- `# a6 ~
simple.LoadModel("C:\\Models\\Test.spp");
( g( C; w; B' s' {! l# y$ @4 T& X; B}
F+ L9 G% F5 Vcatch (e) 4 m0 B. e+ |' j
{ 6 f4 R/ V, }' j* X, Q
WScript.Echo("Could not load Model!"); * H0 z* a- r" b4 B
WScript.Quit();
7 t' x1 O9 u# w( Y+ p# ^7 r- T}
: A) C4 m2 t5 ^) E1 i/ e+ e 1 ^8 n# w% G3 n9 i, Z
try 8 T$ G+ o: T4 d0 t' Y. h4 ?
{
9 V; l+ N, E& c' h$ W- I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , }# h" P8 `* K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + @! n+ l/ K( q
if (r == vbCancel)
, @9 |: c- o' `0 B V2 `5 ] {
2 d: o) V& V( h9 Q4 G simple.CloseModel();
& n2 r% p$ _+ P WScript.Quit();
$ ^1 T0 u/ o1 a4 y# m# f" I* G } # r2 e$ u; [! y; \& \
}
a( k: e- ~: a/ i0 O: |2 W 5 R! i5 H9 i, {: H
simple.StartSimulation(".Models.Frame.EventController");
% u/ _# A0 }6 W / E+ x3 Y9 I2 w9 A- S
if (simple.IsSimulationRunning())
8 c4 F. {) M) ]% Y7 M3 a2 c: t1 ] WScript.Echo("Simulation is running!");
[) d! H$ W- |: Q 9 K8 O8 q! |: S) L
// Wait until simulation is finished
3 ^$ @9 ]" |9 w2 E- O- R/ Awhile (!Finished) WScript.Sleep(2000); % ^. y, k5 ^2 x. D8 i
! Z& Q3 U8 R7 C; M: [simple.CloseModel();
8 b! Y, R4 O- p/ Bsimple.Quit(); ! g1 K. g* z l6 D
WScript.Quit();
/ L( v8 D& \: a& L' v% _# t/ w% E
3 ?9 A7 x; P+ g4 [" G' @' h ) c& E t$ s7 n8 Q. f
function RemoteControl_SimulationFinished() 6 M3 b/ ^' E, r$ M
{
: G- ? _3 d" E! u4 w' R9 ?$ ? WScript.Echo("Simulation Finished!"); |