Example of a JScript
# Q6 p/ b8 u' _* V( H$ {/ _var vbOKCancel = 1; {+ Z2 {( M% O
var vbCancel = 2;
; l$ d& G3 S8 P4 m$ v" I- {var vbInformation = 64; ( W& R5 u$ ^: W6 C* n
var Finished=false; . j* Y W: t1 B, Z+ ~" A0 G
, H4 V$ I* z- n/ a8 G8 f
var WSHShell = new ActiveXObject("WScript.Shell");
0 T9 z! t1 \" D% n1 p * D( `& P9 V0 y% M* q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 ^+ \3 I D" V' E% B* [
9 h- v5 ]; S! ]+ b0 b2 h5 S; x( e
simple.SetLicenseType("Runtime"); $ i _( z( P+ F( e1 @
% _! [3 X" z" R6 r( C1 \
try
1 C( K# b0 L3 o; \( ^. L D{
* ~& W# r }1 r5 U- h+ Y // Enter the path to a model file!
6 B; g/ J( ] B' I simple.LoadModel("C:\\Models\\Test.spp"); $ O% \* n( ~' d5 I
} " E6 ^* X7 K% V$ X& s8 [( G9 l
catch (e)
8 m4 Z$ u3 n6 `5 e{
. C1 @. X8 T9 r6 w WScript.Echo("Could not load Model!");
2 V n( R" U0 S L5 J; n% E5 U6 t; l WScript.Quit(); ; q: j+ ]( h* Z5 t. \" ^
} , V; r5 H9 u0 s! g! k' T1 x% [
% C, _$ w! ^1 m/ O6 D6 ytry
; T, N4 T( D9 Z$ R# z. O{
4 F& n7 O. r, p& X. N* x& }9 Q# g8 _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) P" D8 b3 I b5 E. s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # J: ^, N6 V7 R/ s
if (r == vbCancel) ' n+ u2 M5 O+ S2 Z
{
4 S |# g; F" ^ simple.CloseModel(); . [* a9 p( {6 j5 H) X+ U6 u
WScript.Quit(); 6 _& X5 i5 R# n5 y- h6 u
}
" ]" ~1 o; O% O+ q0 i% |9 h} " s+ e! x6 }: x0 _! [
6 d! ~2 K" W |4 Psimple.StartSimulation(".Models.Frame.EventController");
* O8 N9 ~/ |5 S6 e V5 K
5 r/ D1 \7 x$ [2 X4 e$ P- M) R6 Bif (simple.IsSimulationRunning()) + k' T" P# i( V2 |& J0 o
WScript.Echo("Simulation is running!"); . E: g) ]; ?' m9 F
1 J0 O+ w k" A// Wait until simulation is finished / D I" ]6 n9 ]- n
while (!Finished) WScript.Sleep(2000); + ^% r3 G @* i) n' s+ f- G
. X- i- Q2 W) ~) i6 @5 T. _1 I
simple.CloseModel(); & F _/ h+ k2 S3 u% O
simple.Quit(); ) g% f6 G+ d" f
WScript.Quit(); ( l% K5 I/ J6 S3 Y8 X+ v9 f9 m0 B
# |0 l5 K, m7 ]
E1 H# `" Z x8 p
function RemoteControl_SimulationFinished()
; P7 U7 o- p+ y t, U \+ n. E% ^{
6 t( M$ w% ]! b& I WScript.Echo("Simulation Finished!"); |