Example of a JScript 2 \6 N3 i7 P0 }6 a) C
var vbOKCancel = 1; % R7 a" r9 s9 C% |/ P) y
var vbCancel = 2;
. D# k! t) i3 k( I; `9 Ivar vbInformation = 64;
6 n8 y2 [; Q: }var Finished=false;
- `- ]& E* r' g5 ~+ Z
# r. T( F+ D2 g6 e* O/ M; Uvar WSHShell = new ActiveXObject("WScript.Shell");
. O* m0 X5 a6 Q6 z4 ^3 U, T
" F1 O7 m4 G& n% j# s. Fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * t1 T0 n' x" {! @: w! J9 f6 z
+ T, o* B& @' U
simple.SetLicenseType("Runtime");
' H8 x" X' }* n2 [) }- U9 Y' C @1 h
6 b3 |% c, i$ V, V% y Htry 3 Z+ e4 P. _1 A. P, U
{ . P) h3 z4 H. `7 @0 C; k' ]8 S6 q
// Enter the path to a model file! 8 n" F1 S' v: [3 N
simple.LoadModel("C:\\Models\\Test.spp"); - j0 T5 j( C2 }' ?
} , S9 U" \6 \, ~* V0 N. y
catch (e) ( p. c. k7 @; I( T& F; x- m4 F3 h
{
+ Z2 ~* M8 {+ H+ ~ WScript.Echo("Could not load Model!");
( {5 S9 V" S% q1 y# \; U4 j WScript.Quit(); ) x5 U+ n- g& j4 \/ x$ g
} + ^; E8 l6 i5 H; n# q) H. z
+ @6 C- T, i7 T% W, e# C$ d9 }1 Btry " k* H7 K- i6 E+ } Y
{
6 n$ e' }4 Q- D" i* D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 q! x& J* \. d5 N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% G6 U$ e; z/ A5 E S+ {2 j if (r == vbCancel)
* p3 D# v* n9 v { & W! C5 t7 I( r
simple.CloseModel();
$ i" z( Y* P; m9 P WScript.Quit(); 1 q2 |/ D8 D' p
} ; X- u# }6 n3 k* e H$ o- ?9 u
} 3 y3 p4 s" U- P' U
$ l1 W3 a( r" Z7 S' e) ~ G
simple.StartSimulation(".Models.Frame.EventController"); # e/ q& E0 @) D
g( z# @: p$ s# T+ e. E
if (simple.IsSimulationRunning())
% b' _- ? L- r/ | WScript.Echo("Simulation is running!"); $ R" }- e/ }) ?3 D' s
" j6 V' U: n# n// Wait until simulation is finished
( h/ F6 K/ Q* S3 ] h3 a& {while (!Finished) WScript.Sleep(2000); 8 e9 D( L! D0 Y( ~
# g: s/ m" u' y' N. K! q9 ksimple.CloseModel();
0 y4 j% t: J% o% B/ H# z. Isimple.Quit();
; k/ ~; P) |- q, |WScript.Quit();
3 m1 n2 o) k6 Z$ H) b! Q% L + P$ M6 f- f% M5 E" p1 U8 u
: H& P6 F! j; ^: H+ k& h* \
function RemoteControl_SimulationFinished()
u) x2 W8 J |, s- _9 a3 _4 x2 R0 R5 v{ * `$ ?2 o: R c+ {$ w
WScript.Echo("Simulation Finished!"); |