Example of a JScript
# Y1 _. B+ R( n; ]var vbOKCancel = 1;
3 _8 X, h' l7 }$ d) |var vbCancel = 2;
- u. ?; K4 c! t2 y3 `9 P6 Z7 @/ Avar vbInformation = 64; 1 v% N5 D4 x0 P6 _4 j M' w
var Finished=false;
% M) _# J+ P" E A1 W . F0 s' k; h' d0 d
var WSHShell = new ActiveXObject("WScript.Shell");
! Z: I- k' [0 ?4 Z& B' Z( T5 r 6 c Y# m+ d, @' f2 o2 X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: L# w& p, t( t% q % h$ {. n* a: d5 w9 g
simple.SetLicenseType("Runtime");
5 v4 n) ~: F/ R# w# b" O 0 u. Z* g1 \9 V' ~( P
try , t) n# k* F' j( K, _
{ , Q- e5 C% ~; N5 C3 Y2 e& o# n
// Enter the path to a model file! 6 M* U' F0 u1 y. [: Y+ V
simple.LoadModel("C:\\Models\\Test.spp");
2 j6 c( Y( d* }9 a& j. z} $ G9 Z' `; o* D2 H S( O+ q
catch (e)
' b) v/ q( j- X4 |+ q6 [/ f6 n{
9 w5 I% m" `) j% b: c WScript.Echo("Could not load Model!"); 7 a, n3 |/ m# P" |! n# L7 s& Z n
WScript.Quit();
/ e/ q X, ^: K L} % N+ B- x" a+ L& i# z% L) [* Q. Y* _
+ t$ h& [ q" d# [7 m- s! }try . n3 ^7 @% i& h( ?) g
{ - w4 u# p1 n: g/ ~: A' K. v
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
M: z- p6 V! ?7 k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( b F' F: J& |4 l4 P8 P7 Y if (r == vbCancel)
" U7 s5 f3 n( I) s& {0 E { ! l. @' W: {: h/ K2 z. [5 K! X
simple.CloseModel(); * W; I- S. P7 W" g
WScript.Quit();
: x) ]" b! O. R& l- u; h } " [0 p3 x: D) s* C* m& e1 g
} 3 w4 w1 B- ~" R) n+ h9 o* H, Q
9 y* |- j8 C0 Zsimple.StartSimulation(".Models.Frame.EventController");
3 U3 x( r* I, B4 ~- e s, m( p8 a ! q% J; o- w% \ x7 l% O1 M
if (simple.IsSimulationRunning()) 5 O) i! k; }' y7 k
WScript.Echo("Simulation is running!"); 1 X- ^1 {) L& [3 h _8 ^5 V2 b
1 `# v9 _# ]* P8 V) R8 j" O
// Wait until simulation is finished
* K9 e( @6 a) _5 J6 r9 {8 o$ _while (!Finished) WScript.Sleep(2000);
' Z, t- O' r/ n7 @1 L" C 4 N2 |+ D& t+ H$ J' ?
simple.CloseModel(); 0 h* x$ l. ]6 a# p/ n" w/ t: |5 \+ x
simple.Quit();
4 K; S9 }" O. g) @- H0 P2 I) iWScript.Quit(); " A; @5 O6 q8 F
% {! e. V7 x+ r
7 }6 I' O. n6 w7 @8 s
function RemoteControl_SimulationFinished() ) @2 C5 V, C, x# e- A" p) k a
{ $ s+ S0 F" [; E% y! ] ]" f' Z3 ?
WScript.Echo("Simulation Finished!"); |