Example of a JScript
. o$ J& p/ ]8 K2 q3 U& Z; ~- }var vbOKCancel = 1;
1 }" M+ T8 Q/ W8 l0 {) n' h& \var vbCancel = 2; ; e7 q+ a2 s3 U/ g$ e% v
var vbInformation = 64;
z$ k' j6 X p$ F, V, Svar Finished=false; ' T& C) }/ l* y9 P1 k
7 F2 e, Q3 m9 z1 J3 F
var WSHShell = new ActiveXObject("WScript.Shell");
g! s3 G+ q, X, L9 e3 a/ q
; K% X" }5 ^/ zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; u% W0 k& C' z9 t ~ : E1 T) T4 h3 s& R6 `$ w! E8 S
simple.SetLicenseType("Runtime");
3 T3 x5 t6 H) Q! t9 r, H s 7 c+ M8 h0 y% V+ h6 e* g
try 4 Y: Q7 T' O/ Q; K7 k) Z6 l9 e
{
8 R- i/ n: y5 b4 I5 p$ T0 R j // Enter the path to a model file! ! v* N2 J4 I) n* K
simple.LoadModel("C:\\Models\\Test.spp");
" k! s; y3 Z% L}
* [8 T$ t* G( g7 O3 Z: W+ Rcatch (e)
% J" X8 h6 ?8 l* ?{ - w2 _: `2 F/ ?! I
WScript.Echo("Could not load Model!"); & l3 ?0 w8 D& Z9 u8 O7 @
WScript.Quit(); ( C ^$ S2 r/ s+ I, j1 ]# x% V! ^
} 3 t; F: f1 V; S# P, n, F% O
& l& T/ I9 K6 X9 F+ P, i
try
( N; x8 m7 ?$ h{
: K. R+ ~8 a& @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ B0 u9 D8 Z, n4 N$ C$ u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , H, ^, x5 i' V- ~7 V8 w
if (r == vbCancel)
3 T# R1 A+ ^ r$ `: G8 c { - e3 v) r' B5 d) Z, T8 Y6 E
simple.CloseModel();
, m# s5 u* r0 g) B: {+ V, c: A _ WScript.Quit();
j* i; y' [) `5 M3 A3 _ } 5 e9 W& u8 h! i$ N# |- W
} : ^* w' S, A# X9 ~8 A' k S
7 B: R4 u r+ H! M( y
simple.StartSimulation(".Models.Frame.EventController");
7 k' }8 Z$ x% S+ |; K 9 t8 I4 N: @$ {& c, p2 y
if (simple.IsSimulationRunning()) 7 O; y1 Z. X% F! e2 c
WScript.Echo("Simulation is running!");
! m9 ?+ I: y3 q2 j1 F7 X( |
) h, F. j9 s0 [) [ x// Wait until simulation is finished
/ x# k4 r& p+ V, awhile (!Finished) WScript.Sleep(2000);
/ Y! x7 d* o c4 T4 R$ K' M & k7 V h% Y, n$ N1 D
simple.CloseModel();
# V, |2 Y, k4 L8 k2 asimple.Quit(); - ^7 v0 Y9 b6 f0 U4 A( g
WScript.Quit(); / z' }2 @5 R; m+ n- v
; ?, u& \- y7 ^- b `" Q9 C: V& D
0 G# x! Y7 J# ~function RemoteControl_SimulationFinished()
5 D$ ~, }& M; Z; a( O7 m% o/ o' C{
! u$ `* O l }3 X) Q; O WScript.Echo("Simulation Finished!"); |