Example of a JScript
2 i$ b1 z- s" B0 J* ?var vbOKCancel = 1;
6 O" Z6 @# n1 O2 O# _% G* m# ~var vbCancel = 2; : x5 X" ?/ n' A/ t
var vbInformation = 64;
2 D3 g! v; q9 n/ Y0 u3 svar Finished=false; ( g: y4 a" A+ @1 o. o/ C7 a* j
" B/ |- o9 z4 z2 H& {% ?4 y. cvar WSHShell = new ActiveXObject("WScript.Shell"); ( L# |& [8 a f( i
: C/ C: O& ]# F5 ~var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 U& r9 d) U8 g5 \7 b; V # @) z; x5 \' j* O5 ?9 J
simple.SetLicenseType("Runtime");
; D T, F$ x3 N7 k) R; _' d
0 Y6 k3 n8 o4 }6 X& ptry : N# V" n% ^7 ^- e! s
{ $ a7 ]; d6 i; L) U" k9 K! x
// Enter the path to a model file!
H0 m k6 [) s simple.LoadModel("C:\\Models\\Test.spp");
2 f, H5 H) Y/ ?; _} 8 `' T; W, ~2 G' O
catch (e) 2 l2 S2 o3 w V% j9 q1 s$ }; l
{
# I, U) y, ?( ?9 B! t5 L WScript.Echo("Could not load Model!"); ) y: H* h9 |8 U$ m2 V* B
WScript.Quit();
% g1 ~! v3 |: K0 d# _} ' q% \$ ]4 e& Z' c( {- R# \
; q% [; ~8 l+ _! h, d4 }
try
! m Q/ C. m5 _. M{
* d0 N$ f: ?* ^0 G simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# Q+ m1 Z; O: ?+ U) ]+ p, Y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * T6 r. o& @3 k) G5 t8 s+ i. }3 m% g0 b
if (r == vbCancel) ' `. e& Q% s% P3 y6 u0 a5 K* r
{
( p- A* m" I( ^% p2 ^ q simple.CloseModel();
: g. a. I6 \/ k6 }" x8 U WScript.Quit();
! }0 K6 W# a% C0 {$ Z/ b7 m6 a }
/ i8 H8 c) @2 s( R* _}
+ x s! Q# n( s 9 G, Y( Q9 U, f: W. t
simple.StartSimulation(".Models.Frame.EventController"); 7 u1 y0 S3 E' }+ d
- c# k! q3 u8 [- r8 ^) Q% v) ]
if (simple.IsSimulationRunning())
1 S# \+ x! b/ o+ F WScript.Echo("Simulation is running!"); 4 W ^) h$ J& h0 r
' a$ n' ~0 J* D% Y+ [8 W9 S6 M// Wait until simulation is finished
V" D4 {3 _2 V$ Kwhile (!Finished) WScript.Sleep(2000);
1 w4 G: f# A/ o" m7 C
d2 ?, w2 d( Ksimple.CloseModel(); - H* q# d3 _ K; q: L! A8 ^' i
simple.Quit();
; ^, p% F2 U8 M% n6 |WScript.Quit(); 4 P7 ]2 U! ^! P k/ V
/ L& T$ ], Z+ i: H
5 S. e* z2 ~0 ]' ]" W c% K8 V4 a3 Hfunction RemoteControl_SimulationFinished() / ~0 d! C }- o. |( e
{ 2 ~4 ~( R* i* x* j
WScript.Echo("Simulation Finished!"); |