Example of a JScript
& k) C. ~ ~$ H1 \+ M2 g" Nvar vbOKCancel = 1;
H% s$ |7 N8 q! r! Ovar vbCancel = 2;
; r, u( I$ u; v8 H$ G9 Hvar vbInformation = 64;
5 `: o% ~1 d. F) ~' zvar Finished=false; $ U7 L) x4 ]3 s8 h/ T; K
$ {( A8 f9 N2 |% E! D, X
var WSHShell = new ActiveXObject("WScript.Shell");
% { i3 t& b' N4 y' w
$ _, x0 D6 Q3 v% W) t- Z! n" Rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 n8 J" i% g/ r& A/ |
* o$ X1 I) S i0 k
simple.SetLicenseType("Runtime");
* f* }# U( b4 O3 R
- j! ^0 A& |* G3 Ztry
+ o' H: U3 E, H{
- v, ~6 l' j0 S0 L& S4 o // Enter the path to a model file!
; R' c7 \4 h; w1 k3 j3 ^! c simple.LoadModel("C:\\Models\\Test.spp");
9 }! `5 s" R0 S/ A. x# v2 n. A}
+ |% t% `8 D3 I6 b: Pcatch (e)
. l% N. [- w4 p{ 7 B% x/ I% U. w5 h1 p
WScript.Echo("Could not load Model!");
" s, L8 g# g5 R5 ]( p& L8 `4 k' J WScript.Quit(); ) P2 I9 D$ Q+ G! l, J+ R
} Z8 r9 q6 h! P6 u
" C1 g. ^/ D' }8 m n
try 9 T; m# u% n+ [; _7 h
{ # z- v4 `) C% e9 o
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( ^' t- H' q3 W; [) u7 a0 o" M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); t0 T+ B' _: G V* q7 U! U0 A7 F
if (r == vbCancel)
6 V0 r/ e0 V# b6 R {
! `2 W" m' @) Z# b7 B" S9 W simple.CloseModel();
6 T; g @- C( T- t4 A WScript.Quit();
9 G, F7 b2 y g' c1 ^: ?: r A } 7 I5 l9 L$ K, @' G0 ~; \8 N
} ! G1 J! r0 h V5 `8 [1 e- @/ b) l
0 x5 Q _& X0 E: z5 Y: V5 h
simple.StartSimulation(".Models.Frame.EventController"); & F) u; y, L0 `2 V8 l! i
& X7 D) `3 Y$ \- C8 Bif (simple.IsSimulationRunning())
2 U; o" g4 ~) t0 Q+ L2 T( e4 f WScript.Echo("Simulation is running!");
8 Y5 Y9 ^5 x8 _
* f' Q# M) Q/ C- V; L! F) q// Wait until simulation is finished
3 B0 `- T0 g- b; v _' U6 w3 }( uwhile (!Finished) WScript.Sleep(2000);
/ y2 Y- w2 D/ A7 Y4 N" p, g 6 @" i$ j* A: e# C M8 @, `, M9 t
simple.CloseModel();
2 A8 w& p! Z3 \- v7 L* ^simple.Quit(); 4 g# m7 c2 }. W$ ~4 C5 ^! _& L' z) ?
WScript.Quit();
# E; i' c* B7 J
: l% h% G0 [+ o4 Q! R3 s# f
0 U8 n4 J/ ^, y+ B1 @function RemoteControl_SimulationFinished() / K( |. F4 j ~/ t \
{ " Q- ^" K) l% G; x. @
WScript.Echo("Simulation Finished!"); |