Example of a JScript
# c6 V; ?. A S. S' kvar vbOKCancel = 1;
% b! q% L7 x) r+ B$ fvar vbCancel = 2;
+ d4 r. q3 b% d6 B X4 yvar vbInformation = 64;
- |9 w2 L1 M$ Z" g* Uvar Finished=false;
6 A7 ^! |! \& r7 { 5 t4 I2 F8 E' }8 A+ g
var WSHShell = new ActiveXObject("WScript.Shell");
2 u9 [7 l$ F8 n7 ]; K5 w 6 J$ V$ D& n' d, ~. l
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 p9 p; T% M/ B5 T2 \& g0 q$ ? ' }: p5 w n8 G: s
simple.SetLicenseType("Runtime"); , P6 ^/ o) M( s ]
6 P* b. ?( H( H0 A, Vtry
# s' a9 E3 e5 B- Q J. {{
9 s( w6 r) Q- F. E6 | // Enter the path to a model file!
% s# M) ~$ F7 j simple.LoadModel("C:\\Models\\Test.spp");
" D: m9 x2 A9 u} $ e! J. d, o5 o5 G* M
catch (e) 6 Q4 X* j- _( |
{ " l I$ L3 k, ?& u$ J
WScript.Echo("Could not load Model!"); ) }9 }: X e. h( Y
WScript.Quit();
" `, @$ W9 u: `2 d& V}
2 J( l# X8 W! \6 f1 n* i * a6 L9 m4 i6 `/ ?4 ^- p
try
7 f- w+ q/ j+ b8 a, L; R{
9 ]/ e( F K2 ` simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ p8 k& n( C3 a" D. M' N* i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) y# j _; e9 k if (r == vbCancel) $ q8 S0 K8 Q( Y. @
{ & y7 B+ `7 D7 Y& C% ]: q. w- d# n
simple.CloseModel(); + x) N3 E) J0 B8 ?
WScript.Quit(); 8 X4 X* o& w( i/ ~
}
: H* i) E- n ?( I2 u, _} % u: Y% i# P S+ I' ?
% {" C5 `2 u- a% ~( d3 N' Fsimple.StartSimulation(".Models.Frame.EventController"); - \" Q$ d7 U4 r. T2 s
3 P7 X. }5 c# \1 E
if (simple.IsSimulationRunning())
& G$ u2 _- V8 }7 B' P0 u$ _7 X WScript.Echo("Simulation is running!");
0 |) h! |. ~* K6 v4 t" T% I- E! c
4 s- ~; W8 o2 A L! d: B6 M3 ~// Wait until simulation is finished
( e' Z, y& l/ V2 ^9 Kwhile (!Finished) WScript.Sleep(2000);
# }9 |$ X" h+ |; }+ O+ b9 {
; ` F' k- b& J+ Usimple.CloseModel(); 2 b3 {( U7 u4 r5 M. n) n: J3 a
simple.Quit();
% [+ @, `2 w G' c1 D, y9 KWScript.Quit(); . s0 E# e; e+ I
' h* L+ }0 m, m, v . [. y+ {0 v; l! I6 O
function RemoteControl_SimulationFinished()
. _& O+ K' t5 Z0 _) U{
" P! R& ]) i+ T# G. d4 f WScript.Echo("Simulation Finished!"); |