Example of a JScript
; {$ f' y7 J; I( `, Kvar vbOKCancel = 1; 9 s* m; h' m: C0 I! @
var vbCancel = 2; ' X% |# ^4 z: a9 e
var vbInformation = 64;
) J- c5 y, L+ `9 M3 Svar Finished=false;
/ ^# i7 C' z2 h/ q2 m 1 D9 ~# O, W, m! p2 j, d
var WSHShell = new ActiveXObject("WScript.Shell");
/ e- f2 d" G8 @( X4 Q# _
% g2 q: J1 t/ p Bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 m/ I2 K2 a% |+ B " C6 d- P- I7 G6 j2 S
simple.SetLicenseType("Runtime");
8 F' O0 b7 r" [$ j. F
% K/ a% A- u$ {9 {# r- ltry / C( |, c* R4 t( o
{ - R0 e1 N) S5 [& {1 B0 x6 u- c
// Enter the path to a model file! 7 _4 t% t; U5 g* b( R \2 \' y. |7 Q
simple.LoadModel("C:\\Models\\Test.spp"); 2 C! A2 u, U1 S9 M4 x( w4 p7 `! j5 y
} 6 r' @& A$ h7 i6 \
catch (e) 6 D; ~2 h% c# R1 u
{ 6 b: B$ T K' j& C' z- s1 b
WScript.Echo("Could not load Model!"); 4 Q4 n; n. b+ l+ e1 k
WScript.Quit(); 0 x. D1 s$ ]8 j4 { ?6 b" l! X9 d0 m! D
} 9 v3 B5 K8 }7 _. |
, B* ^: s8 ]' T8 [0 z
try
1 t! a, y5 S& o. T# y& H{
1 T" F S' t. O0 l7 E' y. J/ \ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; W: |9 s8 x7 M, |" X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . U/ ]7 c2 w4 y6 r
if (r == vbCancel) - z( @3 w: P' G6 y& A" ^% o! l; V; W
{
5 H9 J& D# [. c$ {, U9 x! D; ]$ b8 O. d simple.CloseModel();
2 G0 X8 J8 D3 y- c WScript.Quit(); 9 Q5 [& R& k5 j$ {! Q& l
}
. h3 |1 a; n, e' B7 R! r}
3 z) A9 k% x& R: S4 q
0 e& I" a+ z3 l( d) }/ x9 Ysimple.StartSimulation(".Models.Frame.EventController"); $ D* @2 b1 V3 L; `
) y# B' u$ ~/ S1 g3 k0 o
if (simple.IsSimulationRunning())
( J7 k/ E2 |& e2 `8 F9 b( T WScript.Echo("Simulation is running!");
% ]2 K! A; b, t2 l$ W: T+ @
0 t; I! A8 m* J% H% q8 M// Wait until simulation is finished
; j% l5 f+ z5 M mwhile (!Finished) WScript.Sleep(2000); . h% e7 b- `7 C1 X) w+ K, a$ q
/ T9 ?3 M3 D( v' g$ N
simple.CloseModel();
# f- ~) {, M- {- K% C" \5 Qsimple.Quit(); 3 k/ Q: z2 f$ K$ o
WScript.Quit(); + s2 r' q5 D; A& U- T- p
1 D/ H7 l3 i3 k* m
( h" @+ I: ~1 Y; Sfunction RemoteControl_SimulationFinished() " _! i- F5 i" w+ A% Q* \' a O
{ 7 |9 E- n7 J, e1 R
WScript.Echo("Simulation Finished!"); |