Example of a JScript
" G4 {! J) V9 q# t& M# q5 @var vbOKCancel = 1; ; ~" O8 I2 s9 R1 y
var vbCancel = 2;
% h) ^ o" k/ h4 w) l7 t7 i2 ovar vbInformation = 64; ; w. C9 f7 D k' m% R
var Finished=false; ( H* ?, c, L3 K I3 p6 i
0 Q B4 |# B- h7 O" V" J, t' Z
var WSHShell = new ActiveXObject("WScript.Shell"); 3 e; T4 V" X6 z0 k- _
# F8 h" L3 a, O' Z3 y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 W7 B7 o4 \* z9 M/ C
' G a7 O8 R( V2 q) E
simple.SetLicenseType("Runtime"); : `$ l7 s8 f. w/ d+ Z1 R7 _3 P
6 t" i- l$ i; K- P; d2 `6 Ftry
! ~8 y+ |: h- x/ @{
, R w/ [ d6 A8 j // Enter the path to a model file! * H* J& i1 I& |4 I8 @; R5 X4 G$ ]
simple.LoadModel("C:\\Models\\Test.spp"); 7 E: k2 p1 c4 U% Q
}
; M' N p% ]2 I: o* Xcatch (e)
5 O# Q8 _: c( `7 A1 M{
; o% B. V) x6 u8 z% o8 u! A WScript.Echo("Could not load Model!");
5 {1 r) |3 _' W# n# ~5 E WScript.Quit(); ( S, { A8 Y- a2 R; `/ Q
} : j# h; K% g& H& j! p! l" P( {
! b& Z% k8 t6 D; z
try " _+ ~! N0 V5 e1 W& i7 w
{
% c- H1 P6 E" S! w$ ]; A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
?7 Q% r' q3 ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 O6 U( O- u1 ]7 Z* ^
if (r == vbCancel)
( n2 w. D7 W) i4 B { 1 s2 T3 ^+ Q: A- P; O C% B
simple.CloseModel();
" c3 d: x) Y; L4 f/ {- ` WScript.Quit();
7 n0 c0 U" |1 y/ J- k2 W }
' Y( Y- P7 |1 l}
( |' i( ~. z$ \/ L* M( t
6 P t! C$ k2 L U( @. lsimple.StartSimulation(".Models.Frame.EventController"); % r+ g6 n ^' Y4 o4 E* p) T
: }: B, ~ ?* Z* ?8 }$ i
if (simple.IsSimulationRunning()) - O$ S3 I# g5 s' J
WScript.Echo("Simulation is running!");
& U# h! J& I( V: X. e: W
& A+ a5 }/ t$ _4 \// Wait until simulation is finished + v/ W0 W9 u+ @" q$ X9 A! j
while (!Finished) WScript.Sleep(2000);
4 [# H# Y, K& Q. f, y8 b% N
{0 h+ J/ d- h9 \5 E% O" j% ]( dsimple.CloseModel();
2 M; x8 n% x- Q2 @simple.Quit(); 2 q% ]' \* I7 @8 E" T
WScript.Quit();
" p1 z* o1 m$ L # [( ~: x' K* j
* S4 `9 U/ L4 Z. lfunction RemoteControl_SimulationFinished() ' c' A' V6 P. v
{
/ G7 T S2 b% C+ _4 ?8 I WScript.Echo("Simulation Finished!"); |