Example of a JScript
. [9 Y: G! I) [* b3 k) i( x% V4 Y( vvar vbOKCancel = 1; ! O2 V) w- a9 }, V
var vbCancel = 2; 8 y- S% i# P7 z* i
var vbInformation = 64; : I8 |/ X* u6 W a K I
var Finished=false; ! T( [/ X+ v4 C) a/ J
6 c6 v" w4 |- I+ i3 u4 G# S
var WSHShell = new ActiveXObject("WScript.Shell");
, C7 y1 R+ w0 A' [2 S7 R" |3 } f' H
" O! y$ d4 M8 m' J# N" X/ n8 avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 j2 o6 N- E6 P l
' ?. [" c0 J) |' W
simple.SetLicenseType("Runtime"); : G* Y- `: E$ c* k t4 d' Q( b9 F
& f8 W4 b2 U- m4 F7 etry
: }6 O9 _! a7 E- M7 S) s5 J9 @{ $ f& m$ P' m( @, z# t/ P* E
// Enter the path to a model file! 7 T- _* o1 |4 m8 I" U
simple.LoadModel("C:\\Models\\Test.spp"); $ S1 u! E* T/ k3 i( C
} * y8 m5 v Z0 O/ T) d0 }
catch (e) ) R) c% K9 }2 W% U
{ : ~2 h/ d S5 o* ^# B8 Z1 A
WScript.Echo("Could not load Model!");
8 e9 g2 q. B7 [" A$ R: O2 _2 g" ` WScript.Quit(); ) _- n J( i! Z- R: b& S
}
5 R8 a+ A4 T! B" B8 j) P6 V 1 L, e/ b( ^& x- t0 h/ Q
try / g! d9 j* G5 H# b
{
5 ~# |( ?& L( S5 S2 i simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * H- o4 t# O( |6 P' N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( @% S0 ]$ p; _6 l6 o0 Q( T- E
if (r == vbCancel) 8 T4 m1 R V& y! k2 M6 f
{ - y4 U0 V7 I7 I
simple.CloseModel();
# R Z6 `# g( t s" H4 F# i WScript.Quit();
0 h3 e- _ X* \% l }
; u4 r+ u. Y9 l}
u# q# T% d0 S1 B- m# b% U 8 @& I; n! h/ {0 Z
simple.StartSimulation(".Models.Frame.EventController"); ]; e3 }) I9 z* @: c) W# S
! r8 E" o \1 d* e: D: I7 dif (simple.IsSimulationRunning())
8 S+ r/ R! c2 @: N WScript.Echo("Simulation is running!"); & }) q _4 c- p# J
, x0 f" \7 X Q) P( g1 h// Wait until simulation is finished
3 z4 M0 X# k! hwhile (!Finished) WScript.Sleep(2000);
6 ]8 Y7 @5 I, }2 G* e" e6 R' W & g" W2 ]/ j" J* ^; _
simple.CloseModel(); 6 k( K! I- J2 U1 r4 _1 m# l
simple.Quit(); 2 T [1 x3 g3 u( D; ]
WScript.Quit();
+ p* ^* a. [6 Y5 k7 k) @* |
. h, N% l6 B) _4 F F- W5 y; v
9 n- O; |: P. Y3 s- Nfunction RemoteControl_SimulationFinished()
( k9 X4 M4 b* h# d& N{ ( }, O: h" ^! w0 _ T$ c) w6 E
WScript.Echo("Simulation Finished!"); |