Example of a JScript * p# s: ?7 B& R7 W( e4 r
var vbOKCancel = 1;
) }, a! T' p0 g- zvar vbCancel = 2;
! `' n1 D1 l2 j+ v7 Wvar vbInformation = 64;
! X0 E8 a4 w. \7 uvar Finished=false;
' l$ j. N+ F' x x& {& z ) `6 \; B& A7 ? m6 c5 A
var WSHShell = new ActiveXObject("WScript.Shell"); : ^8 o0 C, X- M% @! i; R+ C' R
9 y5 \4 a4 P8 h8 b' N, q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- F4 I3 Q' w1 \. R! y4 N+ n T. n U
, a# x7 p0 l& U, F. X% Gsimple.SetLicenseType("Runtime");
; X' l; H( i. J5 F: A1 ?
: W. X c- n5 X7 {$ x5 Ptry
5 ? a) @4 d8 }% N: C{ + J- F6 u" _0 W) {6 B) R' @
// Enter the path to a model file! ! e, o4 h5 R" o! R" \( o
simple.LoadModel("C:\\Models\\Test.spp");
) Z$ o) a+ s x1 \3 u} ! p. r, O5 b, y) R# v
catch (e)
1 |9 q! h) j# {! K, r$ b{ 1 X( K+ |7 [) D4 u
WScript.Echo("Could not load Model!");
( u6 D' ]& M4 \ WScript.Quit();
# b2 l& Z" ]. h5 `} 7 [+ w1 N. `+ {2 U' `( c K* U
0 _+ b, r- l/ P
try
& _2 @# L% m7 x, \' C{
2 O' S$ m6 h u# | simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , J- f, V5 m% D/ n/ {
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 G' n- ]+ [" z) K
if (r == vbCancel) 6 P" o8 c0 N6 s% K- H
{
0 Z2 _3 {0 @3 e/ r/ m; D. s u- l simple.CloseModel();
0 Q! y* ~# `* d" W( | WScript.Quit(); 1 H3 ~% w- Q- F7 b3 R4 r7 j! e
} & B5 b! B, Z0 W1 v! f5 c
}
% b: m( `6 \5 h5 A# K$ }% ?" |
3 \0 s. ?( }+ K: z3 T2 Hsimple.StartSimulation(".Models.Frame.EventController");
: o* Q/ ~4 ^9 o+ c) Y3 c# q- C- P
' q: s1 E' B( T! gif (simple.IsSimulationRunning())
' o4 l0 P2 a; u' J- Y& M WScript.Echo("Simulation is running!");
9 u5 ~- b& B, @ ! S+ ?# |/ ^7 o6 O/ A' w$ Q
// Wait until simulation is finished
7 M" @5 p- P1 g; k+ P" D& |' Uwhile (!Finished) WScript.Sleep(2000);
9 `5 F4 i0 }$ V- [6 b/ c 8 ]3 f# h: ?3 H- h% G+ ] R
simple.CloseModel();
& u/ ]) f" j& w& I5 j3 Vsimple.Quit(); " ~3 B9 G3 V, ? E5 Q6 Y" \
WScript.Quit();
+ ]+ j6 j8 b e2 V' J0 P& W! Y% P6 k4 O c 4 c7 u- w( d$ o, C( H
4 p7 o" w2 c' ^! F- Pfunction RemoteControl_SimulationFinished() b% ^, y$ H* w4 c0 t/ L
{ ; s, A1 |' d4 M- B5 v2 v/ F5 J
WScript.Echo("Simulation Finished!"); |