Example of a JScript * W6 [! `" W$ V% C8 M8 D; Y
var vbOKCancel = 1; 7 `9 e6 ^) K& n' V+ M+ U
var vbCancel = 2;
5 z% q" U/ O4 ~$ S8 Dvar vbInformation = 64; 8 f7 w* P/ B$ l
var Finished=false; - ]9 W+ l$ u: b( w7 V
( q |( s( y% pvar WSHShell = new ActiveXObject("WScript.Shell"); ; F# k3 f* V M, k L/ y: X$ E, g
# E& |' f. F \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ ^# r; n# q, O3 n
$ `9 d U+ a0 w" M5 u5 n; E! fsimple.SetLicenseType("Runtime");
, Y' j% D$ m" g4 ?, t( G9 N - B! K' c8 }. _5 u! i/ a
try - U- n) Q2 y L- b: E% I$ s
{
' y6 P0 N& K9 R6 ^! x3 Q: _ // Enter the path to a model file!
4 M9 w) A4 U2 C! Z simple.LoadModel("C:\\Models\\Test.spp");
+ e. @0 m4 V0 c* D/ S; I! [$ d} ( ~# _1 a6 C: E( T% N2 o' D
catch (e) ; J) ^1 c. K3 [' ~3 V/ S) ?/ j
{
, C V6 R: h$ N2 Y7 z9 y WScript.Echo("Could not load Model!");
% S" J0 Q1 w. ] WScript.Quit(); ' ]7 s! t7 `7 d3 ]: R( z% h
} 5 ^& m9 J) F: I# k. y4 Z/ [6 ?; s
+ s' S8 L; \) htry e9 B9 q( G3 h9 D2 T6 B
{ ) R4 |! E0 ~! T& D% a3 X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: p4 k8 C' W8 m2 E9 q* _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% U. f. O$ n* }' c if (r == vbCancel)
/ T3 P% D0 O/ r! @ {
" U0 B% C$ e- o0 o; O simple.CloseModel(); & \: x. }) {& m. B, ^# }$ W% y
WScript.Quit(); 0 [( n! Q3 \- E3 k, @7 d; g( k
} & z. ~+ W" v5 E( {" k1 S T
}
6 [6 W0 k' _0 N# w' a, t 1 b2 j- l% U6 p& x- r
simple.StartSimulation(".Models.Frame.EventController"); * P8 Z3 \! a/ a) E
( u0 [( {- R K9 K4 ~
if (simple.IsSimulationRunning())
2 N6 ^9 P5 \ \; @; \" B* ^: P. h WScript.Echo("Simulation is running!");
9 {4 n# J c" M
+ u1 H0 b# @/ m1 i$ K3 v// Wait until simulation is finished
& Y u R' s. \) y2 r' {0 g0 [while (!Finished) WScript.Sleep(2000); 1 C* f. z9 [) R; O3 ] f7 _, ~
( f' T7 d) \, G# P+ w$ qsimple.CloseModel();
% F6 A1 v4 _ ^7 ?simple.Quit(); 6 D% f9 p/ w) C3 i0 y
WScript.Quit(); $ q% O$ B$ _$ x2 C& |6 E: J
- { S* x: m7 X1 w0 w/ |, A
# E( g) B9 D2 }' X5 L6 C
function RemoteControl_SimulationFinished() ' C0 D5 ~& q# v8 t( F7 d
{
/ ~' ?* c0 v+ a' O" Q# O WScript.Echo("Simulation Finished!"); |