Example of a JScript 3 C9 n4 \+ D# R% H
var vbOKCancel = 1; 8 J' p+ c. w4 p( B
var vbCancel = 2; ! {! l3 |& K% G- Z( C/ W
var vbInformation = 64; 0 q# w; U8 @ a3 N6 y
var Finished=false; 0 J' [3 R+ U6 ]$ y- j
) ?, ]1 p- J1 N6 c8 B% p" c/ d0 zvar WSHShell = new ActiveXObject("WScript.Shell");
+ F% k& E2 z# w8 l7 j . Y% C7 R7 r* q& r U0 x( g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , T+ n# K- L$ T" f4 f0 z( [
/ t) m+ |0 J3 t8 {$ V. _% Y) d
simple.SetLicenseType("Runtime");
3 e' I; K; j* n* p; S% i
7 v% P3 H1 L1 B0 i% r6 i- L: ntry
* c D3 T' ?/ \! \* ^{ ! e. P8 M3 b$ O* K
// Enter the path to a model file!
$ C1 [0 @ Q4 J+ O8 M! t, P3 X simple.LoadModel("C:\\Models\\Test.spp"); 2 L. J N$ `/ a& E; [ U
} 6 X/ S3 a) ~4 {6 H3 u1 v. ?
catch (e) ' U1 l2 @- Q4 |8 O( c+ { s; X# f
{ 2 _0 W' F4 |4 S2 O" L6 O9 j x% N
WScript.Echo("Could not load Model!"); . D8 C* O& r9 g) X
WScript.Quit(); - P4 Y2 U% V7 H5 e' i9 Q! _
}
# h$ l2 H/ |( X$ f' e G. S" u. r. Q G4 N1 W
try 7 `, T4 R9 J6 v* j' A
{ 8 X: @+ v( m' Z$ v0 l0 g5 O4 ?- p
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 @! ^" ?) _, p8 e2 T7 x& {8 l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 t6 @- l6 x. M
if (r == vbCancel)
" X o$ Z4 j8 j. S4 w% ] { 7 g" m- M3 I8 a( v3 S* r# l
simple.CloseModel(); 1 e8 b* G ?) U/ Z; L1 N
WScript.Quit();
" q! g- a/ V' h0 e' a# d }
% t9 n3 H2 z" X} ( a4 Z8 W. ?. `. z" t
( i; a- p% I) M# ~
simple.StartSimulation(".Models.Frame.EventController"); : F# K U$ m+ `
5 `6 E* m" w: X
if (simple.IsSimulationRunning()) 7 N- B+ i) b% W9 | m' l
WScript.Echo("Simulation is running!");
: P5 I# e4 f9 ~3 @5 a& U3 { : ^( l0 K- b6 G# t
// Wait until simulation is finished
1 |- J/ W i. R& Rwhile (!Finished) WScript.Sleep(2000);
% h/ T) K9 g5 R$ V7 g3 w ]
& q5 I* ?* \, O% F7 ?" w4 Osimple.CloseModel(); ; s% X7 s* Z; w/ Q: g+ H4 `
simple.Quit();
( a/ G* R; G; \- Y. o" l5 ?: P" dWScript.Quit();
3 H8 Y; w; ^7 P5 e
$ I) I& O- l3 c+ D- a D
. ^. r9 Q$ Y* p5 V1 O5 }function RemoteControl_SimulationFinished()
# p# F5 X* q4 f" ?7 L8 M4 E$ z6 v{
9 r% {# O$ s+ m1 E7 @- M WScript.Echo("Simulation Finished!"); |