Example of a JScript ! z7 A: @0 g7 w, h+ X, {
var vbOKCancel = 1; 4 A9 C) r0 ?) p. M! I) h' p
var vbCancel = 2; 0 Q" \' H3 Z) z T) ^
var vbInformation = 64;
1 j0 r" W V( z( a6 ~3 M ivar Finished=false;
- I$ m/ h. e6 N( J& I1 Q
" P- f6 `1 n+ ~# i9 K' qvar WSHShell = new ActiveXObject("WScript.Shell");
0 Y# f$ Q" B$ Z# ^, G% e ! H7 \; y7 J& ?% ~+ i1 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, ]$ n- F- C: E# v5 b' L
. R; T# [5 D4 e3 Rsimple.SetLicenseType("Runtime"); ' J- e" W+ f, s* G/ s1 A% Y
& a& Z4 S8 Q0 L/ h* \
try 7 i1 g3 {' s7 p9 f4 f" z
{ * P# {. E V% Y0 S) X! X. C
// Enter the path to a model file! # {& y- x7 A! o& {& p# c7 j0 Q1 K& p
simple.LoadModel("C:\\Models\\Test.spp");
0 d9 i2 U- |7 s9 U} J4 f" w7 I& r: ?. K
catch (e) ( f/ w; H' I: j! h( X
{ 5 N( k5 Q9 b4 @) E, H
WScript.Echo("Could not load Model!");
( B' ~5 H6 E5 ^ WScript.Quit();
! D, `/ L1 f7 n$ ~9 p/ J* A} 8 r# H# C6 J9 [+ g0 f5 L# I
$ J4 r' h! q# s$ p* v- {, V+ jtry : Y8 k, k, t7 N5 N) G# k+ u
{ ) g! L }% }9 f0 { l9 A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( k: B, } T! y& Q- q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 o# b& [8 D7 Y5 k" {0 I: q, S( I
if (r == vbCancel)
. c! X" Y! J$ [ {
/ r( ~7 T/ O0 J: s8 C- e/ S simple.CloseModel(); " ~3 Z( c- {1 P' U
WScript.Quit();
5 ~" k) p% B5 |5 W) {" [ }
# K' m4 w1 Z2 P+ N$ T, O} i0 a8 K7 z9 K5 R7 `- ?
; Z( {$ h( Z& V, w
simple.StartSimulation(".Models.Frame.EventController");
! O' m2 [: ^: c & E& l! m$ Z0 I0 E( O+ w5 t
if (simple.IsSimulationRunning())
/ `* E+ F1 m) _1 V$ S WScript.Echo("Simulation is running!"); 8 M1 U9 d$ m6 ?! i/ O
4 P D$ V3 l4 O3 ^5 O+ f
// Wait until simulation is finished
r5 k3 q/ w+ m5 D) Pwhile (!Finished) WScript.Sleep(2000);
; ], Z% R, N8 ~9 x: i ) @* Y: { F: z) ^; M
simple.CloseModel();
3 ~5 n7 c( C2 ^simple.Quit();
6 U/ T0 L, ~8 XWScript.Quit();
2 B9 ]- g9 z' L" g: L! G
0 T g# J) b, @3 V! l( f/ a # s- g1 I5 O' i; ~ }7 A U
function RemoteControl_SimulationFinished()
- s8 R8 B. R) f{
) Q" C# s& q$ U. i5 i, T+ t WScript.Echo("Simulation Finished!"); |