Example of a JScript , r' Z% H) A% y: g0 C
var vbOKCancel = 1;
, \: j9 O+ }. l8 o/ k; Qvar vbCancel = 2; 1 H4 _) C9 N3 k S. C7 s; \' ^6 `
var vbInformation = 64; # L1 M# r9 o0 P
var Finished=false;
9 Z2 o0 K3 Y1 ^" V9 p2 }: D% s- A' J" I * g0 C, A! R7 N
var WSHShell = new ActiveXObject("WScript.Shell"); / Q) s. s( C3 t
8 J& e# @' z4 a( Y; M8 d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; B0 E7 `. ~9 V; v" h 8 s0 G) R% s+ d9 O: \
simple.SetLicenseType("Runtime"); ! p- K8 S, X5 i& i* ]
$ O/ |. t$ z1 {4 z4 U" Wtry U' T0 x5 n2 ]; O1 g' ^& v9 l
{ , O5 l$ l) r6 K
// Enter the path to a model file!
. F! X# _9 N- O4 u- V+ f simple.LoadModel("C:\\Models\\Test.spp"); 3 P3 p( G1 N6 }+ ^% O6 ?
} - {& @1 I) `5 g) a/ Y" \1 Z
catch (e) + K" V# C: ^. I
{
+ _( x$ }: K- i/ g. W( w# V WScript.Echo("Could not load Model!"); 1 N9 J* E, L m1 d
WScript.Quit(); ! H$ D# s V" s+ @# V# s
} . P0 F9 f) U; d1 k5 o4 U5 u! c
; d- O% R& W# Ytry 7 N9 J7 w; z% m: y2 I
{ 0 c3 g, a( Y. |* I1 h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 a- ]9 Q/ ]" W6 V
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # Z v8 x: L* i2 @' g' c- G
if (r == vbCancel)
( }1 d/ y' ^% f1 R {
8 f2 M/ W1 F$ n: c simple.CloseModel(); ' Z0 V/ l4 y5 h( _
WScript.Quit(); 2 v+ v9 D: j, ]
} - `7 X$ P b f0 l2 }1 e8 h; r
} 7 N3 |6 Z# B) {$ ~. ]2 k) Q1 x) W# n* L
2 v8 J$ q9 L. F, p5 y3 rsimple.StartSimulation(".Models.Frame.EventController");
) E2 K2 K) t8 N+ w1 Q8 D+ M 1 L) i4 S- E& M e! t$ g" q" [3 X
if (simple.IsSimulationRunning())
, a8 D2 |6 A5 d4 d0 i WScript.Echo("Simulation is running!"); + N h. ?; m( C
; |% x' B3 `* o// Wait until simulation is finished
0 X7 o Q( l& d o% Zwhile (!Finished) WScript.Sleep(2000);
' i& Z) \- R. j- b
, ]6 V" T- r& v# [simple.CloseModel(); . h; `: c( u9 M& T/ _. e8 {0 z( k
simple.Quit();
0 ^" I0 ]- u' V3 v, d3 m% @- ~6 F7 AWScript.Quit();
' X( C+ d" b0 P' G4 [% ~: c. ] ; I- Y1 e' C! c0 n5 o8 I
) S5 i3 W0 j2 l) o! B
function RemoteControl_SimulationFinished() % l& T/ P- `# |2 K4 e1 A
{ 0 B/ O, t; R b
WScript.Echo("Simulation Finished!"); |