Example of a JScript
( y Q/ L' l) H: ^var vbOKCancel = 1;
: C1 e0 E, v2 _9 D' ^var vbCancel = 2; 0 Y( V K s; D0 h% B) ^: \/ ?* `6 F2 p9 E
var vbInformation = 64;
; Z2 M" ]5 e; F; Dvar Finished=false; / N) L# {2 Y' {( H' @. Q
. H3 M; c$ v. q* b; C
var WSHShell = new ActiveXObject("WScript.Shell");
/ O+ Q4 t+ v; K8 M+ V / ?3 }9 ^" A5 b3 \9 |. s' \( v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & `7 a |" D4 \% _8 r+ F. O
7 \2 K2 G2 x. m; z9 T- U1 e
simple.SetLicenseType("Runtime"); + Q+ T( }' X z, ^1 O
+ c( ]8 _# }; q+ D3 g# q, M+ i1 O
try & s3 K. Z. H i: e B% Q( R- P8 W
{ * Z, U/ A) K& `* V
// Enter the path to a model file!
7 K# j! v# M' Q2 ] simple.LoadModel("C:\\Models\\Test.spp"); 9 t( B! f+ N8 r' a
}
/ N. E! b b i- J3 H- S1 K6 E- Y: A; _catch (e) 4 F: p: }) M6 k: F" ~
{
, R# N" p0 @4 v: j WScript.Echo("Could not load Model!"); " d- b$ [+ k& _6 k; S& }- f% g' X
WScript.Quit();
$ l# r: C0 }3 V ?' t; R8 X8 T# I: o}
3 ]$ l( H9 z8 ?& w/ t2 C 1 t$ J2 O8 ]1 \- F
try ! I# r; V: Q$ ~
{
) w; G* L; l: n* x/ Z* I% x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: W( Q1 e! n0 n, m9 o) j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* ?. s2 n* ?8 A) p8 U* S, U3 [* W5 C0 i if (r == vbCancel) : i. p2 v$ w" U T5 \( z, i, U
{
; ~; o+ q* ^. C/ H6 p simple.CloseModel(); ( P. o% W+ Z, B7 y! k$ S
WScript.Quit();
+ C0 {9 D4 m9 n8 ~' L2 b6 p }
5 ]/ O* Z' y) o; [& Y}
4 Z% u8 B; \1 z! |. C% G , W) l% ?) H4 E9 @
simple.StartSimulation(".Models.Frame.EventController"); - ]& ~, P8 L5 Q
4 l$ Y0 U: d% [+ o/ s
if (simple.IsSimulationRunning()) & l9 e6 e1 y/ \+ C4 g
WScript.Echo("Simulation is running!");
5 S4 u+ ]# _+ L# r & \: v, e# F! l7 _1 c6 R+ w
// Wait until simulation is finished
5 P3 k7 K, y4 A+ d. |. _9 h* pwhile (!Finished) WScript.Sleep(2000); 1 w9 C. X$ c8 x9 C" e/ O
0 O8 J0 P4 `) y* c7 r0 c/ {simple.CloseModel(); 0 z2 R$ v$ T+ B% Y# i L" w D8 Y
simple.Quit(); + C! v! s q' a0 m9 c: }. U/ l
WScript.Quit();
- J2 I6 ^$ l7 }$ j- T 9 T2 s8 ?! I* ?8 E+ @& z- l( Q
( C1 f0 I- q* i
function RemoteControl_SimulationFinished() , l) X e; A9 _) A* p% ^
{ 7 |+ e; z/ [! O3 _; M) v6 W0 s
WScript.Echo("Simulation Finished!"); |