Example of a JScript
& C1 D$ i4 s# `) _& \* Uvar vbOKCancel = 1; ' l! [$ S( W3 u9 W* `$ z" f3 h
var vbCancel = 2; ' W3 e- F; f2 m: ~' g! M
var vbInformation = 64;
1 _2 M1 R6 W, `/ T, o; R' v* Evar Finished=false; 6 ~/ G2 q7 `* `% \( I
% D& M* R Q7 | nvar WSHShell = new ActiveXObject("WScript.Shell"); 0 v/ _% y2 d( ~5 P
4 N0 J K. k- h! evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & x# M' F( F! x8 J
1 b6 N4 V2 [- e2 [3 S$ ]* e, d1 e
simple.SetLicenseType("Runtime"); : n# g' P; q8 R: o& Y
4 I6 g4 e, v% Q" W9 @/ @' e
try 7 ~6 T; L3 `$ M
{
* a1 L/ e6 m }' N // Enter the path to a model file!
) m& U' `) V& r' V3 v- z t simple.LoadModel("C:\\Models\\Test.spp");
$ |4 h9 Y5 [0 H; t5 C} . ]) k! _, U; p9 H
catch (e) 5 q9 D! o0 i- f4 Q' ?1 a
{ , p, J1 t" p/ u' Z* Z( |
WScript.Echo("Could not load Model!");
# L% _( ^9 p5 |7 T; b5 o WScript.Quit(); , J0 H! X2 S/ }8 s' A
} 5 x# z! A- w4 V
6 U% n6 W9 S. H8 b, R$ v$ U* X
try
+ E# q- k5 ~) w: P{ " N( S. I. w! L5 @* B7 K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: ?+ y* G5 f1 d7 k( w& t9 k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* G, \' Q4 O. q& s* B, ~ if (r == vbCancel)
8 Z. k7 l# ]5 \9 n7 k+ ~8 f {
6 {7 D- d8 z, S* } simple.CloseModel();
1 K4 G# F. j2 K' A WScript.Quit(); ( N! w! g8 ]7 v! @, R: p2 g
}
* m$ V8 ]5 e& l1 ^$ A2 [( o}
! D: F j$ v) R1 f 8 x9 Z; S( e/ t! I4 {, A2 S0 S
simple.StartSimulation(".Models.Frame.EventController"); * Y+ Q: q+ ~; w) f) @/ P( ~3 Z
* F, U* w) b/ q# m& E4 Wif (simple.IsSimulationRunning()) & J5 f# t, a ^4 _6 ^: w" ]! W. H
WScript.Echo("Simulation is running!");
D, V, s" j5 L( ^; Q ' a+ Y' y$ J, r% m' i/ j, S% R9 c
// Wait until simulation is finished * I4 t3 i% V$ C2 c6 ]: F2 Q
while (!Finished) WScript.Sleep(2000); ' B% T% x' m2 y7 V" \
3 n( C) Y/ B% Z) P) F7 R
simple.CloseModel(); 0 d) N a# N4 r7 V
simple.Quit(); # K, ?% v% f4 Q
WScript.Quit();
- k3 w9 a( [1 y; W# H. \+ M
Y+ u, \5 X, v" m& {
$ w: m. N' r8 z! Y5 P- a7 w# ~function RemoteControl_SimulationFinished() 2 ]# D# Q/ X, D% s& `
{
0 Y7 @! F% ?( d WScript.Echo("Simulation Finished!"); |