Example of a JScript
0 N# |9 G0 h9 z3 ^) I/ {( ?5 tvar vbOKCancel = 1;
( n7 y: G; ~8 @* t, ivar vbCancel = 2; 9 v. u# N+ q, f6 |
var vbInformation = 64; " i5 d8 a8 I5 v
var Finished=false;
R2 k$ c* ~4 Q, r 8 C3 c; @8 y. l" g1 k* o9 S
var WSHShell = new ActiveXObject("WScript.Shell"); 4 `" @3 Y# R; {, z m# k
3 `8 K7 A0 |* h! V6 |% B
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% Q* n5 J; T8 _* _& t( }
# A* H% ^1 d% F8 Qsimple.SetLicenseType("Runtime");
' k0 c! x. x( G( `% m
S( t& a$ x4 v* X' F9 c9 ]: Utry . h6 T) @8 D: F
{
7 U% \( s3 C' k: y2 R' n // Enter the path to a model file! $ F2 }5 ^# N: U5 }) [
simple.LoadModel("C:\\Models\\Test.spp");
# N6 e- [ Q( s} ( y: X- j2 t. e4 h
catch (e) t. Y3 d1 u3 D z/ c) O
{ 1 \7 n% l. l( `: K$ j, u
WScript.Echo("Could not load Model!"); s | [$ v. Z1 a
WScript.Quit();
+ N$ J8 L, e; h} 2 c0 w6 }3 V6 s0 c8 V) _6 G, g
# W$ F' L/ Y0 i
try
5 m; R+ T+ b u* V* O{
@. U0 e( K$ F* y4 w8 Z9 D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! S5 b) b V/ T; e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 v3 c) m) s; P/ w" F
if (r == vbCancel)
- e4 S3 G& z4 |4 W r. u3 E { 1 |8 x- W3 @ c
simple.CloseModel(); " s0 N `- f+ b
WScript.Quit(); 4 N4 V* R' e/ g; N
} " E3 f# t! x, l+ s- E0 r% p3 j
}
3 x( C: h$ h5 {2 J/ e7 |
5 l: y4 ]' p' Q% t1 L6 Esimple.StartSimulation(".Models.Frame.EventController");
F& R# U8 Q: u / S5 B% B' R' O7 ~7 n3 h5 v
if (simple.IsSimulationRunning()) 3 w( e+ d1 f: l; [1 H1 v
WScript.Echo("Simulation is running!");
, y: j2 ?4 W6 o) a4 I4 A9 O) c
4 X3 Z5 c; k' B1 ?3 i! Z// Wait until simulation is finished 8 d7 s& q# u6 p) }/ @8 f
while (!Finished) WScript.Sleep(2000); + n# h2 |* B0 e
4 u3 N' H9 }+ g' F3 m& b4 ^- n# L9 J( W, jsimple.CloseModel();
' r# n# C5 \' \# F! Hsimple.Quit();
* r" \; n0 N; E2 SWScript.Quit(); 8 s! |9 ~- Y, z/ b+ @# V5 H1 y. J$ L# O U
$ {* U; v' i( g; ]- g6 t- [; G
T% e5 d; Z9 yfunction RemoteControl_SimulationFinished() * t+ V" }. t0 t( H9 ]6 M2 u
{ : i' {; K; g: w0 G E
WScript.Echo("Simulation Finished!"); |