Example of a JScript 0 B M( h9 f. L- Y( n
var vbOKCancel = 1;
* J: \0 ~# L) ]& i$ L1 l+ r1 Avar vbCancel = 2; # P2 F5 r/ Y3 g( v) n# o
var vbInformation = 64;
, D$ x: v# o8 q0 f* _' ]var Finished=false;
' L* V# I5 j4 H) G9 M1 p
! B. p, z, _! ~4 T* P( Ivar WSHShell = new ActiveXObject("WScript.Shell");
/ a% q* B$ l% z+ ^* M$ x i* M
+ p, f7 {4 b$ Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 z8 M$ s1 C0 R& o
# ` a. R6 E- q3 i% D" asimple.SetLicenseType("Runtime");
$ M( O' p0 w( S9 o" M
. [! F6 U" S) [. W. \$ T/ ftry ' l X# m2 ?/ ]% s0 R4 K# ]
{
3 o% c0 V# p' E2 K/ ]1 t* { // Enter the path to a model file! : F- S( g y- n+ _: N. S. L/ A7 M
simple.LoadModel("C:\\Models\\Test.spp");
( M8 Q+ s+ M' U2 y3 V% \}
& J1 H: G @5 r- R9 M. L$ i( k6 V. ]; tcatch (e)
1 V3 j) Q5 A( f7 B{ 6 V0 L9 r, d; n
WScript.Echo("Could not load Model!");
* |# k2 b& U( R7 { WScript.Quit();
+ F. }7 G6 u0 ?4 d* J} - F+ X% Z, S( Y; y# e+ P5 p( F% b. O
E$ Q0 E$ N/ d# } U- G
try : S. }9 p& O( |+ s7 ]
{
: G8 f3 E- s5 A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% W7 V% f6 H l n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 v& ^9 w0 ]) Y6 P; D* Q6 g if (r == vbCancel)
, @8 z( i: y5 P9 \* w/ b {
& B# n! K, w9 `7 M+ d6 e simple.CloseModel();
# c+ J s" u9 W WScript.Quit();
3 B4 V" \& [4 { |. s i } 2 m1 |0 \5 S7 C* [
} 3 o. m i$ \. m
, |+ u6 t( v/ a3 Csimple.StartSimulation(".Models.Frame.EventController"); 3 ?- f- P4 g( x6 r! S
' a$ l9 O9 X$ ]if (simple.IsSimulationRunning()) ) G0 S( Y* j5 r- ]) ]4 T. D% _7 `
WScript.Echo("Simulation is running!"); ) I% j3 Z% N- p6 b1 o. u1 Q
3 w/ V K! R; K- v; c5 b
// Wait until simulation is finished & p( x5 v) H+ m
while (!Finished) WScript.Sleep(2000); 9 x7 `9 @$ N0 L* V8 e7 ^
/ h6 B/ M9 I1 G# f. V k
simple.CloseModel();
6 C, i5 P" H2 @; q7 lsimple.Quit(); 9 W% J1 j9 G2 U. {& {3 L0 ^
WScript.Quit();
" G& A* H' p6 E+ A1 k5 }: a & f, m8 J3 {9 B( f/ S4 l
% P; f0 m5 V- [' {) l9 ~ g) n
function RemoteControl_SimulationFinished() 8 y5 Z$ r4 J) o7 i6 g1 T
{ / W. i5 |, [) x% }0 k+ a
WScript.Echo("Simulation Finished!"); |