Example of a JScript # r* {; B4 d/ I9 u
var vbOKCancel = 1; 2 R' C! h5 L6 m" x. l# o% y% y
var vbCancel = 2; 5 A2 i2 h2 F8 e( j
var vbInformation = 64;
, v" b5 n; Y9 g3 R$ c( W. q9 fvar Finished=false; 5 v' U0 v' Z9 W! \
( y9 [! S3 R1 m8 w$ c5 z- p, G
var WSHShell = new ActiveXObject("WScript.Shell"); 4 F, B4 h$ H$ w& I8 M2 X* Z5 q
4 E; ^# Q! K7 a, Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % y- B/ T R5 F
2 V5 }0 X" N5 @simple.SetLicenseType("Runtime"); 1 X! s5 p% X6 \; R9 p8 M1 q# ?
" p/ n4 e4 n& N0 r
try # \2 W, Z$ R" Q
{ & L9 S4 L5 l8 z3 W' t
// Enter the path to a model file!
2 r# @, K: J( E: P( h( c! l2 I simple.LoadModel("C:\\Models\\Test.spp"); & S2 Q1 |5 ~0 @- L4 ]- e& k
}
& Q* T4 D2 F4 B9 t! Bcatch (e)
. e7 [& O) \6 c2 [4 F. P) H{ & I0 E. C7 D" O8 j5 S* a ]; W+ z
WScript.Echo("Could not load Model!");
, F0 `; g: o0 a* d" V/ j* r$ P WScript.Quit(); : m% {- L4 c. h* u: r; T
}
, k& H& z! ]$ q3 H, O0 D
8 R9 h$ P! O3 V$ {8 R( a otry
, c# J0 e0 }- A* K6 z& Q2 I( n) C{
' o% ~7 N9 D0 E; r7 [3 w2 d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 n0 s% S3 v5 Y9 q( x# {3 R/ F" I* T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! p4 ]. h' d! i, k2 ?8 V4 E
if (r == vbCancel) 5 r; S. H) ^2 w- I
{
* E+ R; i0 ^/ b9 A; W simple.CloseModel(); , u3 F8 |: Y# p7 V3 S6 F3 V( [0 {
WScript.Quit(); $ @+ F7 a- z- V; d- x7 G* m z
}
8 ?7 T. p6 r# R( T+ [3 h} 7 T1 D( {- f( ?3 L$ v
' ^$ L- v) L& O" W# W$ ]simple.StartSimulation(".Models.Frame.EventController"); 9 X; w. |5 ?0 h! q! D" m
& U0 q- e: A- Qif (simple.IsSimulationRunning()) ; \& I. f9 T5 Z& Z+ @
WScript.Echo("Simulation is running!"); ) l+ @% e) M1 Z v3 M9 N
9 L4 ?9 s4 N, B% c5 M
// Wait until simulation is finished
5 D+ M8 _5 j5 w7 Y3 C$ hwhile (!Finished) WScript.Sleep(2000); 5 @& f9 O; k4 }" E f
7 U2 e" m& B- esimple.CloseModel();
) h0 x; F+ q: ~# f3 h) A7 ?. esimple.Quit(); ! g. T0 _7 W6 m7 d: h2 ]0 Z
WScript.Quit(); ' }" T. j; x' G+ p- v/ e
' M6 c# o( t1 g- `$ `% Z
9 D$ \5 Z m- s$ y; I/ X. yfunction RemoteControl_SimulationFinished()
6 b! L- S h" e# S; h{ ) a' l: v( ^; h5 ?) @1 V) z6 x9 E
WScript.Echo("Simulation Finished!"); |