Example of a JScript
: N9 b& O9 z. N4 Evar vbOKCancel = 1;
: e* B6 t( V8 a; Cvar vbCancel = 2;
: u6 x4 u' c" h3 k) c5 W% Zvar vbInformation = 64; : s, j# N( r& c" @$ V4 l' w
var Finished=false; ' Q! v5 X( T7 G u2 M
' D A5 u0 Z2 ]& Hvar WSHShell = new ActiveXObject("WScript.Shell"); ! l) i8 F; ] s. o. \) e5 P% [
+ R* d% o! q5 s6 @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) l6 m' q7 @3 p/ d4 f ~/ e$ H * [- V+ p* {7 W& X# U
simple.SetLicenseType("Runtime"); : x: R: D; E1 }: P) S! S2 R
' c r' K9 L* D/ i% r7 T
try
2 O3 W4 b1 o- T/ R{ 8 ]7 m! ~. A% m- _4 V
// Enter the path to a model file!
" `1 s; M; A5 a w0 ~% {& F, v6 a- ^ simple.LoadModel("C:\\Models\\Test.spp");
7 S/ J$ P2 Z& N) N+ L} 5 Q9 x2 e: J- W4 m4 O5 q
catch (e)
2 X3 Q' s# z' K2 _& O8 }7 E1 }{ : A9 |( i. Y) o* e) m+ E
WScript.Echo("Could not load Model!");
2 J; d, G) l1 V( T6 D9 H WScript.Quit();
$ U! G1 S+ J. w; d}
1 t; w2 h5 p$ j) N 6 G; v" p$ v1 X& T6 c0 ~* Z! y
try 6 u+ Z6 D1 a* c* w( e* z* Q
{ 6 z4 \ W$ y6 H- N- o
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' K% E# \9 R& \# c1 Y2 {+ U& Z, l% z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% a) ?: v& ~/ ^) X if (r == vbCancel)
8 \6 `8 M; H0 y6 q3 q { # H$ H, j# C) O3 S$ h7 |, k
simple.CloseModel();
& x4 b N" `! }* I2 B% D$ m WScript.Quit(); ! w* S" _; ]3 \" v7 k
} 7 C0 u4 y9 B) W( A) U& B
} / s3 w/ k+ q4 N7 U0 y) `
' b8 h! }3 }- ` S! I) }5 @
simple.StartSimulation(".Models.Frame.EventController"); 5 f* u) b- B, L; g2 c' s
1 A6 J% v1 s* G
if (simple.IsSimulationRunning()) " h6 @! d9 t% d* r5 m
WScript.Echo("Simulation is running!"); ) v" y$ x" f3 f
7 `/ H' g7 N5 K5 Q
// Wait until simulation is finished ( s8 K0 q6 i% ` x/ k
while (!Finished) WScript.Sleep(2000); ! G9 Q; t* e2 j! w
3 _' r1 a+ a( F7 v I4 a" E
simple.CloseModel(); " |& A$ Y* O1 v6 p5 ?' z9 G6 T- O
simple.Quit();
# g- `$ [0 w; HWScript.Quit(); Q) e" q. e! m. U8 Z& D
, e9 U' K: H. ` : I1 b( [8 `# V+ ]( y" C
function RemoteControl_SimulationFinished()
; [8 M3 I* u- V; q. X{
D3 X0 v! r# E% y9 F1 A7 d6 |6 o WScript.Echo("Simulation Finished!"); |