Example of a JScript ' ]; h* r9 ^, Z( i3 y* L5 p
var vbOKCancel = 1; 9 `9 x+ S, Y, t! b$ z
var vbCancel = 2;
/ W, L) H9 ^& i7 Avar vbInformation = 64; $ Y9 m M6 N6 q" G
var Finished=false; 0 \5 o& p" e% r5 H q
5 _9 C5 S/ V/ ]& Qvar WSHShell = new ActiveXObject("WScript.Shell");
4 S" s* t' @# {" _4 l0 A7 q
% F! b3 g+ D' z; x4 evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 r0 K' ]) w/ Q; x
+ e# c; u3 H6 z! |0 k
simple.SetLicenseType("Runtime");
* ^- i6 }- E- ^0 R) V ~0 m. t
4 w6 c+ {" [/ y4 j% t" K3 Ntry
) f* P8 U# R+ w1 p{
' ?9 j }) g. U( y5 p // Enter the path to a model file! $ p% W' y: [- N
simple.LoadModel("C:\\Models\\Test.spp"); : M$ {0 V. Y/ g. c
} 3 Q2 N* _% x7 Z+ ?+ m
catch (e)
$ F9 n/ Y5 `/ ~1 d: W( N{ . c' S( G1 n2 Q% ]
WScript.Echo("Could not load Model!"); 8 K% ^ h- ?; j2 j
WScript.Quit(); , P" E: G5 @/ P. W0 g# g
} " Q4 r/ G( y! x4 v% s: g
* \7 ]7 v! g" | P6 W7 z( w: {
try
) I3 z8 a2 C B- ?{ , h# j, i( Y, p/ A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 z8 j" G1 m( D# I* a R! i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 T( `$ y" S) @0 L! e
if (r == vbCancel)
$ |6 f1 @; b2 M) t/ Y { 1 i" |$ V/ m: V0 @, } Q O
simple.CloseModel(); ( W% O0 ?& z9 ~* Y
WScript.Quit(); 5 N' l1 S4 x/ I; p
}
/ r# K w/ H! Q/ _& n5 o& C}
* [0 j! x' z+ O" z) b - B6 {3 y1 E4 \2 |! o: A
simple.StartSimulation(".Models.Frame.EventController");
# Q) B L4 R" z. [- y5 s 4 }2 K4 `: O% o) g% _
if (simple.IsSimulationRunning())
9 A& ?, \. y5 N l6 {' s WScript.Echo("Simulation is running!");
" ^& R% U$ F6 p! p1 f/ b+ e
d* U" t* k: x% ]; E& r2 m! }+ {% _// Wait until simulation is finished
0 j7 T+ x2 p! z7 j4 Z# Uwhile (!Finished) WScript.Sleep(2000); 0 x* P4 _8 Z, b0 a% M$ C# V
2 L/ C: l; O" U: Msimple.CloseModel();
8 y Z z. w# lsimple.Quit();
; {$ f) ]' o% B6 ^WScript.Quit();
3 A. _0 N) g" U9 J7 _' ]
9 d$ B! h" M& }5 W
7 z5 \6 _$ W5 ?function RemoteControl_SimulationFinished()
% A+ j' G- _ `{
! E) S5 \ ?! h5 i4 Q WScript.Echo("Simulation Finished!"); |