Example of a JScript $ c; n6 i# p9 h( v2 W2 S
var vbOKCancel = 1; 0 R3 B U: Z2 K' A. j
var vbCancel = 2; ) N3 T; X/ W2 l
var vbInformation = 64;
1 H3 J4 `. S/ t V6 z! \5 l" @0 Svar Finished=false; 0 `1 c/ s) Q: ]' e9 J8 c* E. c
& z. c9 Q R. Xvar WSHShell = new ActiveXObject("WScript.Shell"); 4 V$ H# s( m$ y' ]- y
# J4 x* N: O( s# N* F" [) t T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * y; O% H+ o) q p @+ ]
# _; I3 M& X4 l Hsimple.SetLicenseType("Runtime"); * g! T, M9 J. ]$ n
" j) ?" L+ v* V$ N: ]. S' q
try ) i) e! N) Z- q% Y% g/ H {- N8 c' i
{
" l: I$ g& N( n# z4 s2 M( x // Enter the path to a model file! : @) ^; f6 [+ \; j- g1 u; k) V- _. F
simple.LoadModel("C:\\Models\\Test.spp");
# I! l8 _ p* p+ I( S} , M! g3 ? E& L: I" M( G
catch (e) % }1 i+ ^% }% i/ z9 Q% p
{ ! f+ _; e" e, L+ o5 M0 J, j6 ~
WScript.Echo("Could not load Model!");
. q; @3 l0 [6 @% ]0 j0 z" L J8 i WScript.Quit(); 3 Q. B) Z6 ~0 y7 o% M& r E$ h2 u/ i' ]
} 2 h/ K8 Y7 e3 G/ D s% _. p+ G
8 B- z3 q& ]8 n" H% c7 h/ ktry % B# C0 q2 X9 r9 w- y
{ 1 {. G& h9 l3 ~" {; Y1 a" F8 k
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) i$ L1 A( x" H6 X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " l( K5 u t7 @4 g t* l+ |
if (r == vbCancel)
+ K# R7 l+ t) h( ^) R7 H { % z1 k$ o/ {) ~8 F3 G3 n
simple.CloseModel(); ( U8 s5 F; m) U; t$ J
WScript.Quit(); & ~& W0 i/ v" x7 f" V7 U% V: ~
} 6 Y [' U5 u9 z- y
} - J* V% A/ O# [, U2 l2 i. B
2 m* k0 U- x% e8 Esimple.StartSimulation(".Models.Frame.EventController");
P% x, B; y: v. z' m) [
3 h w( ?5 H0 b3 n. |if (simple.IsSimulationRunning())
8 P6 c2 p D) |6 J WScript.Echo("Simulation is running!");
! s/ t; S- j$ s ~/ v2 u7 p 1 Q' }- `7 H$ `4 J/ `3 L) j5 B) Q
// Wait until simulation is finished 5 P: ~! F; m' {9 S% E$ {
while (!Finished) WScript.Sleep(2000); 4 b2 A: s$ c; g, z. I+ F
$ W# l2 D) u, ]' \simple.CloseModel(); ) W6 `4 r8 B$ r# R
simple.Quit(); # Y" A X% B: n! f7 _; _
WScript.Quit();
5 Z3 |; k# s9 B$ ~3 Z& R5 Q. ~ % {4 u G) W' _6 P) e
2 C7 `( c" o: i6 m4 ?function RemoteControl_SimulationFinished()
2 [* o0 R1 U1 R3 u' E3 f) a{
7 t6 G8 o8 f, v" m: K- ^9 m WScript.Echo("Simulation Finished!"); |