Example of a JScript ( p' B W9 x$ \/ G
var vbOKCancel = 1; ) {8 B& r+ g- t* ^% ]7 X
var vbCancel = 2;
) ]! [) A) |7 s* c+ V% }var vbInformation = 64;
7 |; v6 \9 q% u% G0 S! Vvar Finished=false;
! t$ @7 V0 l1 P; `. Z# E/ E ; R \# L- c! L
var WSHShell = new ActiveXObject("WScript.Shell");
5 y# {/ O K8 o+ F8 y% |
7 P) Y* \) L9 B; h9 ~var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, U% D: O( }3 t' X
5 T: w% r8 }: V6 u. U# P2 Hsimple.SetLicenseType("Runtime");
5 O, f0 D/ o# f( J . ~& Y0 ^/ ~3 C5 Q! {4 g6 z0 I! i8 D! j
try
# ?% h: b! x" U1 e) ~8 S" j. d4 R{
! e, l: m* Z4 v R7 W // Enter the path to a model file!
6 \5 M: A5 j/ H2 H simple.LoadModel("C:\\Models\\Test.spp");
$ U, p& B1 E4 w. W( q0 F% H2 T/ F} 3 W3 G, g! Y7 F: g. p5 x
catch (e)
4 \' \1 Z ^. w{ % w, H7 u0 Z) y1 ~% C" v5 a$ S
WScript.Echo("Could not load Model!"); ; s* L8 `, x- n9 Y" h
WScript.Quit();
2 S/ R0 t8 q# j/ B}
6 J0 p& s6 |9 [1 W% q! h/ M( d
* h+ P, A+ s0 {try $ w) a9 ^8 U$ @) v4 [; ^
{ 5 ~. v9 M8 E7 B" K% f
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! @( l e8 r' `' I3 S& U b# T
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- @& n2 R' E; Q) j# l+ P: L if (r == vbCancel)
0 ?$ E+ w2 I( a2 m" t% ~( g; p {
' `: `3 M3 c3 d# K+ U3 h. U: y simple.CloseModel(); ! C% z# |6 Z4 r
WScript.Quit(); : x- W6 t3 Y9 g- c
} 6 ?0 N$ ^ n; W/ m$ k
} 9 i$ K) j! ^5 w1 ?
; W. ^ P4 e# K! L! x' V
simple.StartSimulation(".Models.Frame.EventController"); % U; Y: N' R* J$ w4 _( R
, r z( l! a/ S
if (simple.IsSimulationRunning()) 8 H3 {7 E% | v7 g
WScript.Echo("Simulation is running!");
; `& s" D0 o) E! u7 `) ^; v$ S% |
3 u$ S8 B2 N# c/ G// Wait until simulation is finished 9 ?( Y/ J" M9 \3 R
while (!Finished) WScript.Sleep(2000);
" d- S5 L4 A* f2 Q/ |! t # O" D1 d0 J7 p# x. m8 V, [
simple.CloseModel();
) n$ y8 Z) x8 e% qsimple.Quit();
# J+ N# P: N' a# j8 V- G& sWScript.Quit(); - Z% s: y8 Z! D. u
$ T; f. f/ N2 o- D; @! r' @7 u8 J
. x0 h* Z8 f9 {3 @0 Tfunction RemoteControl_SimulationFinished()
! f# w2 |- V. w* j) p4 O0 v{ . J1 _7 b8 w \9 _- h
WScript.Echo("Simulation Finished!"); |