Example of a JScript ) J# Q3 P; r/ g3 c3 s8 x
var vbOKCancel = 1; : W. m- H3 ~, [0 r9 c
var vbCancel = 2; 7 J) M% Q5 c- F
var vbInformation = 64; & ]. \9 t" b; K$ O" ]: m0 S
var Finished=false; - @" E& k9 |. S! V" I
, }+ F, Q7 c; E" O4 X" E1 F
var WSHShell = new ActiveXObject("WScript.Shell"); ; e, G% v: B9 Z' L) k. t; x
$ V5 c+ M/ Y2 n+ B4 P9 n4 z$ ]
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / P' @7 u; J7 ^8 T K, G( Y
9 B: u! h* {4 Z' o0 R& E
simple.SetLicenseType("Runtime");
9 p3 p8 j8 T) X4 i5 n
+ W! y G$ l5 M% z6 P2 J. O0 K! y8 ntry
# Y7 Q7 {# X4 n8 g: k{ 5 x7 X( U m% \2 Q+ ^, ^7 }
// Enter the path to a model file! % v$ t0 U- R. h: A1 d$ R
simple.LoadModel("C:\\Models\\Test.spp");
/ g4 ^+ V }5 F8 J3 @}
4 Q2 Z7 i% I# z! Scatch (e)
2 s6 j- d) f- \' ], c' i8 E3 ~{ 7 s4 r" B; g& j) G
WScript.Echo("Could not load Model!"); * K/ a( \7 C* {9 G) X, L
WScript.Quit(); & b2 O0 }( O; X
}
7 o/ T% n* z: b6 m6 V3 B7 B' h
- ~1 ?8 `; }5 g: Z% B, otry
% Q( _4 ]* K2 }; a# |2 _3 ?: f{
6 g) O5 T1 x) G9 g& j2 ]4 ~& m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, P/ I. m' A7 x r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! ?) I9 [# Q+ I% B2 u5 n if (r == vbCancel) 6 E/ ]3 U6 a% l" X7 E
{ 0 {- c9 g4 h( _4 d
simple.CloseModel(); 5 _! a$ j* d6 n& f+ }" p- H+ a( m
WScript.Quit(); : ], Q7 P( t7 E# j
}
9 S+ }+ g' ^! e$ i% |1 l2 f$ D} 2 r. k6 }- d; c% I
! M% v5 i( u2 Jsimple.StartSimulation(".Models.Frame.EventController"); 7 i# v% o- @0 h0 l0 l3 I) s
( V- ]( A5 s* @
if (simple.IsSimulationRunning()) 3 [) s+ B- p. q* i6 P: V+ }
WScript.Echo("Simulation is running!");
, B+ m7 ]0 U0 h! Z- v" g1 S
4 n/ F8 b2 H; B// Wait until simulation is finished
! S. p5 g/ t/ Ewhile (!Finished) WScript.Sleep(2000);
7 W/ u7 E1 N5 j* W% A
9 E# a5 W3 a6 xsimple.CloseModel(); . Z: G/ F- N; @ k/ y4 F* k+ w
simple.Quit(); 1 G8 H$ l6 R6 V1 Q6 v
WScript.Quit();
- ], v$ r9 _- }( o: b ?# E8 G
5 r/ J* p- R+ `8 h( m 1 |$ n4 g% q3 a3 v- |+ V3 I1 Y6 ?
function RemoteControl_SimulationFinished()
, }/ i# [$ w0 A' P) m$ t{ & R9 O( M; B. G# P
WScript.Echo("Simulation Finished!"); |