Example of a JScript
8 k( s1 m! N+ ~! [% ~$ I) [var vbOKCancel = 1;
) t' o- E9 T: ]0 f. d, ^var vbCancel = 2; 1 H! @/ B1 I& Z( s7 v
var vbInformation = 64; # E4 D8 W0 K% T9 h+ b& e4 v1 h, S
var Finished=false; $ u) Y3 x" G. q7 q' N8 y
! N. [" [: W+ i* b6 x! t( e& z
var WSHShell = new ActiveXObject("WScript.Shell");
# u% Z9 {9 Y& B; Y5 t' W/ I 6 c* J: |+ S9 k* D+ p' w; z1 }- P# `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 g* S0 I/ `: t' Q+ r
* Q3 F% X7 ]) U7 Vsimple.SetLicenseType("Runtime"); 5 }! E5 @) H. J
* q0 F* K! U$ ]- s: K" }try
9 W1 l& u8 O0 I. \2 ^0 W{ 3 l3 |( p& B* x. O. i6 v
// Enter the path to a model file! # a) W# E% a" L$ V; z* `
simple.LoadModel("C:\\Models\\Test.spp");
& h, v7 s c9 }# Z ~} 7 G$ c7 \& p5 N' P' x
catch (e) ' o! s3 J( f) X7 t0 [
{ ; k; N# R: R$ u/ P z
WScript.Echo("Could not load Model!"); 9 u. d- S6 B$ F/ U) T. M
WScript.Quit();
+ W" L" ]. Z5 I6 i! w" X+ Z$ [} + f* S( d3 J( E* H# G/ j( Z: }
3 B, H. C4 E7 T& O+ I
try " C. M: L; A. P, _ a+ o$ `) p
{
: h; L j5 d9 } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 G/ Z8 t0 K2 F3 T7 t
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* {7 Z7 e; \6 W# k" o0 z if (r == vbCancel)
y* _* G g8 L8 k { ' F7 i5 U- I& M% n4 l0 {4 W4 _" H
simple.CloseModel(); " M7 ?' C( Y3 a( ~( z( m/ F
WScript.Quit();
( e, W9 p, v( c2 ?& J& [( ` G2 w } ) J1 U9 u/ F: q2 Y
} 4 P" o* D% y+ \6 Z
4 y; I# W8 p3 q4 _; P& Qsimple.StartSimulation(".Models.Frame.EventController"); ' r% G$ W7 w e8 h) B
& q9 y, d F+ `& l9 a8 E, [/ ~if (simple.IsSimulationRunning())
- J% v+ O% ^. j. f WScript.Echo("Simulation is running!");
) [ A6 a, r( }$ L3 z , |7 _* }, a# h( l7 E
// Wait until simulation is finished
9 n$ Y1 x* S3 a5 Z3 `: Wwhile (!Finished) WScript.Sleep(2000);
% l) _$ Y* u; b+ m: j) }
9 g! v! F6 ~) v, o& Fsimple.CloseModel(); 1 P, Q' h1 C1 K. A
simple.Quit(); 1 L2 X0 [6 C1 K! W, g$ X' |4 w; s
WScript.Quit(); " A0 T/ K$ h' d: p
( y6 Z" C0 L9 O7 | 0 `; r5 b( Q1 G4 ^" j8 d7 \% A1 O
function RemoteControl_SimulationFinished() * ]) g/ v0 U( k1 ]
{ * z* P2 j" [7 p! Q9 u, A$ E- d/ R0 i
WScript.Echo("Simulation Finished!"); |