Example of a JScript
. o/ t/ A9 h$ y. Y) o) rvar vbOKCancel = 1;
i6 r" J8 _& R1 Z" C0 j( wvar vbCancel = 2;
. O/ ~7 c0 ^8 s4 T+ H; W- rvar vbInformation = 64; / N3 Y4 s t$ @0 D6 b
var Finished=false;
3 V( `) ]4 S* v* K( J9 R1 g3 P [2 z % F- R+ F6 V# l. f% P/ v4 h1 }
var WSHShell = new ActiveXObject("WScript.Shell");
- d4 `6 J s2 Y. N; q
& r# L ~' b, Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. L# i, X3 \- d( J/ Z8 D; J3 X
$ t! J: N4 j. T8 R5 esimple.SetLicenseType("Runtime"); 6 C$ | q- L+ ^3 i
" g% j2 z1 t! Ntry
: p+ g; b4 d, S8 ^- K6 _{ ( \ r7 E# ~3 \! i8 `8 ~; Y
// Enter the path to a model file! & R, K5 j+ d+ p+ {% _% i+ V
simple.LoadModel("C:\\Models\\Test.spp"); 7 i% z. J5 P# c; l
} ) S N! I' x. p( x) }
catch (e) 4 i7 n7 t2 Y! Z, O, \" {
{
% s) @' I2 h4 \ WScript.Echo("Could not load Model!"); * d: X6 T/ P& e @
WScript.Quit(); J: F+ p8 G& p/ @$ K. \
} 6 c2 i. Z# I# ]: b/ {2 z4 G5 d
1 A) g! z3 v6 T6 }7 [
try ( W2 }* L3 O4 w f6 l: }! n1 x
{ , H' ` y1 Z( S* V3 Q/ i6 N3 \ }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& ?) q |, H/ l# @8 O. D r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( r) |6 W+ W3 V4 g if (r == vbCancel) & A+ ^# `, ^4 c/ Z
{ $ m# u. I; Y1 {9 ? z( G+ Z
simple.CloseModel();
/ K; w9 b) C+ _ WScript.Quit();
7 N: K3 {. R7 A( Q7 O* @ } , v' { [- w" e! k
} 0 m% @# T0 B9 ? Z
$ t* G% [* D5 V9 b* J2 I- {. ~
simple.StartSimulation(".Models.Frame.EventController"); ) J1 G: m- R8 `$ p
4 d0 | K3 m' ^0 oif (simple.IsSimulationRunning())
3 B) B! h, w8 e; X* O7 C WScript.Echo("Simulation is running!");
2 a) w( W& |6 c8 ^
I7 [6 f3 N) N) T; w' h// Wait until simulation is finished - g% ^# c6 k7 p! ^8 E
while (!Finished) WScript.Sleep(2000); a {: P) Q: E' ]3 O
; w+ v- T9 ^2 s2 f; G8 q" i& Csimple.CloseModel(); : Z0 S0 M0 v0 y$ `
simple.Quit(); . ]$ z* S* Z4 k
WScript.Quit(); 8 n8 V; E6 p4 j7 s
7 q6 x0 W/ v( a8 P
! U- B z- p3 q& |7 w
function RemoteControl_SimulationFinished()
E; d. G) @2 n: f6 N{
; o4 g H" |/ f3 n WScript.Echo("Simulation Finished!"); |