Example of a JScript
% W4 |( r8 X# O4 svar vbOKCancel = 1; ( y! M1 L0 _6 G# }( |! O; U
var vbCancel = 2;
( @$ A' X" b! {3 y# dvar vbInformation = 64;
. o7 x% `' w% d6 wvar Finished=false;
$ }0 x( N, I+ v ]& }2 u d 0 j( }% f( t. Y+ T
var WSHShell = new ActiveXObject("WScript.Shell");
" u) m+ B) q0 |* g5 r
9 J( F' W i0 Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 y6 g% o) c4 n + `; F' q2 E' W
simple.SetLicenseType("Runtime");
. g+ k/ m$ y) w: \% S; ]2 f. @
. ^: S0 D! e3 A" ^, ztry ' j& J& @) Y" R
{
' E# V* d5 M J // Enter the path to a model file!
4 t9 Y' u" Z) P simple.LoadModel("C:\\Models\\Test.spp"); , ^: h* t5 A& d# B* G$ x6 Y, q) d* o% v
} 9 L$ G; G) L; l- ]
catch (e)
9 F% c6 ?( R$ h8 J; T{ - a2 Q7 G: ?( d9 l
WScript.Echo("Could not load Model!"); 2 Y3 i" Q1 K9 R5 q; z' {
WScript.Quit();
) \" X, g2 M0 M; _6 ?0 Z' U} 0 O7 M+ n- Y) |& j
8 d9 b }+ X" n* g2 ?4 S6 Ftry
: w9 n; \" v* ~' ?7 s{ # U$ B( F; J, A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& J9 e6 x c5 e" p3 S& _% q7 D r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + c ?) N. E7 y1 D4 y
if (r == vbCancel)
: D% i8 a* a, F: ~5 c {
8 u4 Q8 y8 x7 y6 w$ G simple.CloseModel(); + P/ ]3 Y/ _0 r9 [9 ]! {; O8 d
WScript.Quit(); # Q& L M# k3 ]9 k4 @1 T
} 9 E' C8 H9 D. I, S, d; E" s
}
7 q7 n; _0 j4 x* u% X! ~% N7 {& O ) _- F9 ~+ P& s8 c
simple.StartSimulation(".Models.Frame.EventController"); : s; i& i7 I2 t' G% v
) \) e4 L) h6 z" Bif (simple.IsSimulationRunning())
3 Y' l4 H0 e' }" k1 U6 h( r( Z- k WScript.Echo("Simulation is running!");
3 w4 q" }4 I; Q ) D* Z8 \; U: p% [+ A& G; _ O/ L3 T
// Wait until simulation is finished ! [# S0 O7 l; ~- n4 O2 k7 ~
while (!Finished) WScript.Sleep(2000); : @0 k, u% V3 s" H! e d
: @9 O& F7 Q4 a) {) z2 h" K& u) d- r
simple.CloseModel();
$ @- U% [. n; p* X6 esimple.Quit(); ) i' n& I8 @5 x3 X
WScript.Quit(); % E) |. }' H5 t! S) R$ b3 B5 g
3 G: w8 K. Y& u/ ?9 }7 ^
; H+ h0 L, e& N2 ?% F jfunction RemoteControl_SimulationFinished()
0 v, M9 @& |* c{
O. d. f8 o- w9 F( r6 ] WScript.Echo("Simulation Finished!"); |