Example of a JScript
+ h2 N) P& @5 \/ o: |) kvar vbOKCancel = 1;
) S$ U# S* f) U" F' U* jvar vbCancel = 2; 0 v6 K/ |4 s7 H2 B4 z' y# i
var vbInformation = 64; 3 q1 f3 H* R: o: b
var Finished=false; , z8 b2 J' c0 H. J4 J; y
" R; G0 e0 R2 s$ V* b7 x0 T: W
var WSHShell = new ActiveXObject("WScript.Shell"); 3 i- y+ {' u- k6 S5 r" |7 o" [; B
; |" l, c: p$ o# Y, k/ G* X( g% Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# w- D, L8 [5 U$ @0 z, l: r+ y 4 R7 Q+ n8 \5 o8 P
simple.SetLicenseType("Runtime");
2 h( {. J1 {5 q
4 X$ O; h, R+ b+ K$ V) B, \try + z+ r P1 i/ p! d* |
{
4 ^8 [) T# k5 O // Enter the path to a model file!
' H2 x! H. A( m! S simple.LoadModel("C:\\Models\\Test.spp");
* q" B! o8 k+ Z, B+ |5 s) `}
! i4 j/ A0 z' z5 |catch (e)
; n* w7 \6 c0 P2 V/ G M4 m' {{ . m6 w K; x2 I! K7 y2 }4 A- Y5 T
WScript.Echo("Could not load Model!"); & Z5 m; B7 F8 F* d# a) n
WScript.Quit(); & n! q% l( |$ |5 ?3 Y5 m: E3 h
}
# d2 E5 _; u# j& e/ v: P* G
( i" S/ e: `3 e" q$ Ctry
% S! b; y! R' K) w* G{ % u' w+ z# b* A5 |& x. O0 w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% B; A$ t) y8 Z! G M' d2 H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& P1 h9 y+ F& n% L) s# d if (r == vbCancel)
& Z; j1 S" d0 S. z | { 5 B2 Y) d! {6 l- ^9 y9 x
simple.CloseModel(); 7 [0 d: e8 d7 A! q i& O
WScript.Quit();
- w# }4 A2 Z# j" l" B5 |# J- F } . J/ L( ^9 ?% {! ^
}
9 i0 {1 _4 U: ]" r; ?
, |% S7 g& T! J1 asimple.StartSimulation(".Models.Frame.EventController"); 3 L) H+ _+ y& }! ~! L6 M/ P
' n# ?: v" J) oif (simple.IsSimulationRunning())
7 @# G6 b: o, D2 _) a; e WScript.Echo("Simulation is running!");
; q$ P5 ]8 }4 J- U8 \3 {! g4 h
$ ]6 W$ [( ?: }7 i4 }9 A2 ?3 @// Wait until simulation is finished 2 d, Y2 c6 t# i$ C0 q; Y- k
while (!Finished) WScript.Sleep(2000); ; M! {9 Y1 {. J, H( q4 }- y: a
4 }. U) v5 I# `1 b% C( d
simple.CloseModel(); 7 k% y6 v2 `+ X. m8 B
simple.Quit(); 0 Y" d0 A; _$ Y. l
WScript.Quit(); % O' k3 `: X* C
) r% C5 @& h; R
. o; w; y. J9 \6 J
function RemoteControl_SimulationFinished()
+ M8 w* G0 Y* _# G{ $ w! w/ l0 B1 `7 w) u% o
WScript.Echo("Simulation Finished!"); |