Example of a JScript
$ ]# w9 o ]" {var vbOKCancel = 1; 1 Z! G" `5 h2 M
var vbCancel = 2; 6 O! O2 t6 q% _6 g3 Z0 B
var vbInformation = 64; 1 S9 }# l: e( W( ^
var Finished=false;
; `4 U9 [. w$ h6 N ) ~% X* w" |6 z$ I3 D( h
var WSHShell = new ActiveXObject("WScript.Shell"); , g4 c, f8 o$ w7 M- B; l4 v1 g
8 L* n x9 Q5 J, s3 P4 K: }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. I B+ D( n" ~
4 O" s e& o; \6 m: usimple.SetLicenseType("Runtime");
/ }% J7 _+ B8 p) S! {: w
" L/ _( ]6 ?( y T! S2 x" ]% ltry * e- N$ J5 m' d' w
{
' W& T* b) ^! x# e- I _ // Enter the path to a model file! 1 d) U5 b- y/ ~9 S& |
simple.LoadModel("C:\\Models\\Test.spp");
R( ^! ?8 M' y8 Q1 O0 ^3 G) c# Z} 1 U# ]! @5 j! I; {! }# H2 l; i
catch (e)
* U% `9 @2 X' @9 h* H9 x{
: q# J% I, |) G, E6 O WScript.Echo("Could not load Model!"); 7 V1 N. y9 Y# U+ j
WScript.Quit();
( S$ F F7 ], L/ I d0 P$ `} & ]5 q! t# U1 h% D F* D8 T
W. `6 Y+ d$ f2 |+ i' Dtry " N$ \7 P0 Z. q8 ]7 d
{
1 a2 V0 U6 ~: O9 W% P simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ q( l. @9 b: K0 l8 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) ]/ w$ d+ m- v if (r == vbCancel) . H' \% l, _& Q8 \! p ^ B
{ ' |. B2 e4 ?" ]6 u/ B
simple.CloseModel(); : i- J5 ]+ @& e1 P8 i f0 U
WScript.Quit(); : ]+ \& s3 F! B
} * B, B0 R7 b8 D9 ]
} " Z7 w8 ]9 H; f+ d" [7 G
" T0 l) |! F% ?) R! ]simple.StartSimulation(".Models.Frame.EventController");
+ b( h7 ~. n0 m6 u3 u4 h5 l. z2 I $ O0 @; }( b* k! f( Z* M- F# c
if (simple.IsSimulationRunning())
# T" |* v! | D8 H% u6 l% R+ ^% B- u WScript.Echo("Simulation is running!");
& ?% V1 P) e" }4 I
/ k4 c4 S c5 ^2 @6 E! A, N! f// Wait until simulation is finished . v2 u T* A7 w7 p0 n! A! V& I0 k$ o
while (!Finished) WScript.Sleep(2000);
7 m' L- z" S9 |! X
, X l' b" t' E: s Osimple.CloseModel();
! Y, J* B T4 hsimple.Quit();
5 u% D1 Y7 H0 ^) j VWScript.Quit();
2 J# ]0 g+ B t) t( Y
* V- O+ f7 ]& E" ^; j $ k" M0 w3 H3 X l. k& L
function RemoteControl_SimulationFinished() " I! z6 m) a9 c2 x6 o3 u. U
{
. t" d; J5 x2 m: d: r A WScript.Echo("Simulation Finished!"); |