Example of a JScript % u/ C0 ^& A' o: e- N" F
var vbOKCancel = 1; - p0 i) p, \, T& ~% P
var vbCancel = 2;
: a* {+ L# A5 f0 \var vbInformation = 64; ; S) _" t6 G/ m6 l- t* [, @3 a! r
var Finished=false;
4 u' C! c. k7 }* c J8 d% R9 V& i- Y; ^
var WSHShell = new ActiveXObject("WScript.Shell");
1 c- n5 A0 _- T' H$ m . `) M* D7 A: r- Y$ I& P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 z+ B4 S: H: b6 F: E+ o0 O; C
6 \8 q6 @$ V9 g' D( r& ysimple.SetLicenseType("Runtime"); 0 L4 V8 i) U8 t" X- _2 S
' `! X2 O1 r. i3 P( k
try : S3 J/ E1 H& s9 u; F
{
# l# d, T3 V' n9 o // Enter the path to a model file!
/ J! @& \$ @' O, O simple.LoadModel("C:\\Models\\Test.spp"); 9 H$ b# V0 r" P; }0 y
} ) t9 f( i, D6 T d' P+ y; z
catch (e)
6 a/ s8 ^: z5 [; P4 {1 M) v{
9 B6 {- I' Z! ~( }) T% X WScript.Echo("Could not load Model!"); 0 P. w7 @" `/ `! q. H$ s
WScript.Quit();
. q% h/ B7 A0 W' b. M}
% T7 C3 N# v/ q. ]* n! ?/ R; h) Z
. w- M2 A' x& [; }- _4 Ktry ( p8 @! S0 e+ p
{ 5 g2 j1 Q) B4 o" c( W! D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 }0 c- j4 y6 g# b* E. G/ L* x7 i# |% P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 ?8 h1 [0 [ n5 g! Y2 c, E if (r == vbCancel) ( Q9 p" x: @1 r5 e: R0 C
{ $ l% [7 O* E: n7 M5 E" n9 U: W
simple.CloseModel();
' S* Y0 R* D0 P6 Z8 G8 z# n WScript.Quit(); : P0 i) [# w7 i! j
} 0 Z9 z6 |- l3 l; e0 [7 R; t
}
' i5 T: A& Q. B( ]) p W $ C; O( P3 l( h, C/ v, ` ]
simple.StartSimulation(".Models.Frame.EventController");
" A& z0 D; i& u ( Y( g/ N0 ^$ H" x# d& Y
if (simple.IsSimulationRunning())
: i4 [0 P# Q( z+ z WScript.Echo("Simulation is running!");
8 W' [: q$ }" r' P: Q$ l8 x3 w& j
& M0 c6 J& B; W- O2 l, Z6 B8 m0 z; {0 z// Wait until simulation is finished
) H+ E5 A3 b+ t3 Rwhile (!Finished) WScript.Sleep(2000);
! ?( _3 G+ ]. A' H1 G 0 a6 e+ H( d. \) u0 g& ^* M: G
simple.CloseModel();
1 ~# I& F4 C& Nsimple.Quit(); # P! k8 _& x: R4 X- u6 j
WScript.Quit();
3 f$ Q' L7 i8 |/ T! O. [
5 z' m! P1 R6 k: h) j/ J( K( H( l9 ?; I , x% |8 Z" T4 W0 k
function RemoteControl_SimulationFinished()
( F; f# R$ |% h; r2 G{ & Z% ?5 E# S/ t8 O
WScript.Echo("Simulation Finished!"); |