Example of a JScript
" q+ @. ?+ p# t! G8 @var vbOKCancel = 1;
/ B6 G; H9 Z6 W" |8 {& M( A+ z6 Xvar vbCancel = 2;
; c8 N8 c/ D& K* d1 ]var vbInformation = 64;
! I0 G% @: G, ?" t- L! e7 b1 Xvar Finished=false;
0 S4 V; k9 }* N% Z * D- Y" R+ D0 u7 a0 y
var WSHShell = new ActiveXObject("WScript.Shell");
9 i, O, Q# x e% o# ? $ A* } B6 U7 Y; ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" H: l y6 o6 U) O 1 T0 j4 n" o1 E
simple.SetLicenseType("Runtime"); * f1 _* i" t" H: o5 ?
' j% w( Y/ g3 |% _0 h) l5 ?" {; {try . j) g4 u, g7 F* D6 w9 V5 Q" |& n% C
{ ! o( ^1 Z: D; r' _% `: O% j
// Enter the path to a model file!
3 W1 n5 c Q! h4 [3 b& I* Y$ k simple.LoadModel("C:\\Models\\Test.spp");
! `$ v5 k1 q* g+ ^- R}
6 w* k2 @% L; x/ o" f0 fcatch (e)
* `$ ^; ~9 `/ d1 A1 X# T( K{
. ^7 Q7 g$ e7 f+ o9 X: p0 ?# w WScript.Echo("Could not load Model!");
+ R" `; U4 ~ S* k$ t WScript.Quit(); 8 p( W$ p# b0 D3 n; S0 Y+ v; }
} ; Q B" w; P8 d8 s* J$ [' c" O; G$ ]
# z6 `$ S9 q3 K# k8 V" k
try
# g0 e# e! h% i{
: I0 [2 _: h6 p! Z" P6 S simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 l& Z& |: `+ t! \ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % @4 A1 F) n: s
if (r == vbCancel)
& V2 _* _+ L; @, s {
7 V! ?+ e8 r. F simple.CloseModel();
6 }& B) b- w# g' h- c WScript.Quit();
- P% r3 K! g- p& ~2 T2 ? }
+ \2 ]9 K" a2 t& |. v/ ]}
# O8 @2 A% r t5 N0 f! ?2 {8 z
; e" V v9 Q( m- m Osimple.StartSimulation(".Models.Frame.EventController"); % G% @# m6 {; ~
/ u# m" O. p0 o9 b1 C; t/ n/ a0 ] K
if (simple.IsSimulationRunning()) / x- Z! H p7 V
WScript.Echo("Simulation is running!");
5 w& U+ c- _+ p7 q. @6 F9 W: Q. F
7 @ V7 @, r5 ~, o5 Q// Wait until simulation is finished ' x0 b6 s2 y) i2 ?+ E
while (!Finished) WScript.Sleep(2000); , w/ p) L) t* V7 B0 [" V, {
4 Z# J2 c' b5 U+ r6 R2 Hsimple.CloseModel(); ) R- m. R! p4 \- T1 a
simple.Quit(); 1 i9 H) |- U; q3 a" h+ ^2 H
WScript.Quit(); + y; |4 D1 x% c7 ~; W
6 G: j* n* d6 o5 I 1 I/ X2 ^ \( }( D) H' ^
function RemoteControl_SimulationFinished()
1 f9 q. i+ n. @3 h! O. F{ 7 X2 ~, f6 E( t n2 _$ C
WScript.Echo("Simulation Finished!"); |