Example of a JScript
, C/ D$ u" o1 s8 }var vbOKCancel = 1;
; t% L/ Q* b) u9 S2 Z* Z4 S: dvar vbCancel = 2;
4 I4 R* Y) c. g5 T- evar vbInformation = 64; - w( }" x. j) X+ v4 x( p
var Finished=false;
4 c/ t$ T# H+ {. ` @7 d
' ~* V" F' r3 E0 H5 j g7 l1 l" Xvar WSHShell = new ActiveXObject("WScript.Shell");
C/ q/ t6 B: K M, z. ~
( K# A6 l o0 ~% T7 Z) [- j. avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; l+ K9 C5 c8 T9 Q) |8 E 8 Z* K0 y" e N# n, w" a$ l
simple.SetLicenseType("Runtime");
, z# k0 V. r( M( Z
8 ]& J1 E, B N- b" ~4 Utry
" M w' j8 C1 M( e" `. o* J0 Q{ ' |0 i! n; O0 l% U7 E
// Enter the path to a model file! 9 d/ p! V. N) }2 j; q8 x2 Q
simple.LoadModel("C:\\Models\\Test.spp");
' b# i% ]! x- R/ h# K} 1 d3 B( O) D. ~$ J# Z+ b) ?8 Q
catch (e) / w8 r% |+ X7 |3 w/ |4 F
{ " x p8 Z. K% i5 t4 G% u" F0 w! V
WScript.Echo("Could not load Model!");
, G9 R& K, d1 h* o WScript.Quit();
. K0 P& _# P, Q}
. p3 Q0 _- b0 i4 b/ h
c1 E" [ e5 G3 j: Wtry w4 s1 ]9 ^0 a) X7 P6 l
{
a4 P) R& L8 `5 }" \- i& ^" q0 R7 ? simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) H( ]8 N+ \) r2 {; _6 w* c$ J
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * o" D1 d; `+ v. W2 a9 T7 o
if (r == vbCancel) $ R8 Z" A9 {7 n; l
{
+ j' j/ `8 A+ U9 u7 D0 Z simple.CloseModel(); ; }. {; L9 I! J. s2 f5 e
WScript.Quit();
/ M- U, A) g2 v+ V# B3 q8 q1 @ } # Y! g9 G& p$ ]$ N+ v8 ~, d
} 6 A% V7 M3 g& \
0 N! F5 G# }! o
simple.StartSimulation(".Models.Frame.EventController"); $ @* ?* H7 L* d4 l
& { j5 i% C& s( J
if (simple.IsSimulationRunning())
; @& i# c* |2 [. b7 d( p WScript.Echo("Simulation is running!");
; b, v) D: [2 [9 r
! k: X. `: J% ^* d+ A% ^1 [' ?// Wait until simulation is finished 3 C7 s4 n9 C! B: q
while (!Finished) WScript.Sleep(2000); # W& ?: G9 O @# N
# v. \. O( q$ U+ N3 ]+ `# f$ i5 Isimple.CloseModel();
* ~0 a4 j; P+ |7 F( F0 e1 J8 ]& Nsimple.Quit();
% L0 d4 ?4 \1 B, E( L+ AWScript.Quit();
: c. z. U# t8 l. d# S
0 X: l' ^, Y9 @& k) Y9 o , J% c9 j7 x, g/ w
function RemoteControl_SimulationFinished() % T' G% _5 F' R* N2 j; r1 H. Z2 a
{ " n% C8 K f; o: }2 T
WScript.Echo("Simulation Finished!"); |