Example of a JScript
8 D8 J0 d) E. W5 ]var vbOKCancel = 1; 4 d: d& h4 ]0 K, h
var vbCancel = 2;
8 _. {0 @9 n# G' tvar vbInformation = 64; 4 Y2 P0 E; R( c7 N1 _
var Finished=false;
- r5 \$ T/ e$ U9 a8 k! r4 | $ l9 R. s1 U0 t; ^2 }5 g+ x
var WSHShell = new ActiveXObject("WScript.Shell");
% ^) @, d7 l: t
8 @8 o# x; c( ?: j* F! t+ M" hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 T8 `4 j4 H- t % ]* a- O6 A' M0 ^
simple.SetLicenseType("Runtime"); * S6 |4 Y+ O7 p" y: k0 W, C
9 x% s7 L0 w2 C" ]
try
& y1 m$ R+ D8 _, Y6 N{
( g* a3 U3 A- |2 F7 \ // Enter the path to a model file! 7 n" Z. [- \; N) ~+ ~1 e) T
simple.LoadModel("C:\\Models\\Test.spp"); # E7 {( O; c. K H9 p) H( \ q% D
}
& ?+ y4 E$ C( x1 _0 Fcatch (e) 6 @- M2 Z$ R+ X4 Z
{ * I5 x9 M" W2 F) }6 Y
WScript.Echo("Could not load Model!");
* q$ b }+ v5 [ WScript.Quit(); - D4 K/ l! W, G+ K
}
, V7 I5 u i0 \& G
9 J. A. P7 j1 O' stry , w5 p- t m) e; K/ O% t
{ Z2 k8 o7 K$ Z: I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; p9 \! L- {0 c% ? g r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( l$ c# Y! {/ ^8 `6 U8 l
if (r == vbCancel)
" Q( _6 s6 }, [; K: C& d {
/ V8 ~, t3 J$ Y! a' n" g simple.CloseModel();
' g! Q# h- c% _) P) h7 ?0 V" ^ WScript.Quit(); * `, {, {$ H& t: b( Q
} 6 A2 X1 E0 |% _6 g3 a
} ( y! r. i9 l# S2 k+ ^
+ y9 r# G" a! D1 ]+ B; x# }simple.StartSimulation(".Models.Frame.EventController");
1 Q) r! t: y* t$ y : g; D1 b1 _' C0 J( U
if (simple.IsSimulationRunning())
* B! G- ^" G6 [2 [4 F4 ^( U" S WScript.Echo("Simulation is running!"); & x+ u, b: A( I. K* j
- A& T: J3 T5 n' O! j
// Wait until simulation is finished
4 C( t, `, i' Y* Pwhile (!Finished) WScript.Sleep(2000);
* v# X( q2 C4 t7 | 8 z& R! O0 ?% ~& U Y; I
simple.CloseModel();
" q9 g( u% N; B! y, }% Isimple.Quit(); , M- a/ _, ^3 u
WScript.Quit(); - s! Z% b6 @ X, e
- O+ w0 x$ W* F9 A9 Y2 L- J
3 _8 k' E* M! f1 }7 }
function RemoteControl_SimulationFinished()
: g$ A; }4 e) [- V2 E3 E{ - `& g8 j( M2 `4 g* I6 {! E' V. y
WScript.Echo("Simulation Finished!"); |