Example of a JScript 3 g, N1 u; o5 @+ d( `
var vbOKCancel = 1; 4 @9 h# s! Y' L* p) s4 A7 a. T
var vbCancel = 2; 4 b" l6 X# e" a- E
var vbInformation = 64;
8 p$ Y( j! q) x) s7 i5 ^var Finished=false;
0 N2 o, Z) r+ X2 M: ?5 o/ i
/ R/ J' k. i8 r' [var WSHShell = new ActiveXObject("WScript.Shell");
3 V- o1 X7 }4 h8 H: k1 I' r, p
. o7 h8 e0 J; [1 Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. t* G9 }& r& I3 V. y. l1 P8 P
4 j0 V9 v8 E8 D0 Q3 `/ @8 J5 `simple.SetLicenseType("Runtime");
; g- j1 l0 R2 }2 E+ ~ ' k3 f$ h0 n4 }; P M! d1 R5 F
try
, Z# P+ k! k `! p9 ]! \2 }3 C0 k{
, t+ ?! B6 G0 Y4 ` // Enter the path to a model file! ; S7 {( t% K& N
simple.LoadModel("C:\\Models\\Test.spp"); 8 H7 t1 K6 u# D2 x( v0 M
} 8 y* Q" ?2 \' ^
catch (e)
* d' p$ S7 W. u: ~' t. ?{ " A! a, i) I+ x4 l5 r
WScript.Echo("Could not load Model!"); ! S# P" L* [, h. F, A) F% V3 U
WScript.Quit(); 5 e1 P! a8 ]- H, ^) q# e
} $ I4 D1 ?% x. H
% a. \: I9 {1 D+ P
try 5 i7 F" i+ ^4 m6 _( E) y
{
8 w- l, s4 ]& | simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " @ F6 S7 R- ~) `/ D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : J5 T2 @/ n' j* _) f
if (r == vbCancel) : S$ T) Q! a- j: i
{
: L: A) g) ~' j4 q( u6 T. z, i simple.CloseModel(); " w# G) k! ]( A! y
WScript.Quit(); 9 R% d2 J2 X& N$ g3 x! {; Y
}
" Q" m' }& ^. ]) i( H} 5 }6 B! ?3 c( {& `. U& ^7 U
. D5 }$ W2 A! L$ Z* Usimple.StartSimulation(".Models.Frame.EventController"); & }1 p+ K4 p1 `9 Q6 k
7 b. V# h& f& v) C- A) D
if (simple.IsSimulationRunning()) + v J6 C, b$ F% @+ w
WScript.Echo("Simulation is running!");
7 i1 e/ d/ P2 e3 H/ c+ A % M5 g& y" h) H& c" n' G. z4 D
// Wait until simulation is finished
7 H4 V# {5 U: s: `& xwhile (!Finished) WScript.Sleep(2000); , m# O" w6 z9 d5 [
0 o; D Z) D p; @4 |) {simple.CloseModel(); ) Z4 [1 V! c, v, ?+ ?
simple.Quit(); 2 w e! A0 Z2 W- u* p7 |, o
WScript.Quit();
, s2 z; H" n, q8 N * L6 P+ K" o; D: D" U
; `7 Q. l* W) X. P8 f- b. o
function RemoteControl_SimulationFinished()
. m( D' T2 `) J6 U# B& j{
" j, A2 i) c3 S5 L WScript.Echo("Simulation Finished!"); |