Example of a JScript
$ q; V% L, }+ i9 [; Hvar vbOKCancel = 1; 9 r3 Q8 f4 T; X0 j' w
var vbCancel = 2; j9 I+ A3 v! T$ P) z
var vbInformation = 64; r+ Q' a( |3 q9 e
var Finished=false; / D4 Q& |- ?7 A! x" a; N: d9 M
' l; `" Q. P& a' s5 o$ Pvar WSHShell = new ActiveXObject("WScript.Shell"); 1 ?& q/ D; I& @
5 p1 _, R1 c1 A. f- bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' B& {. L0 }% |0 V& y, D! a& W
4 ~1 |1 G* n) |' |. fsimple.SetLicenseType("Runtime"); 6 t2 N& B6 y# y
! D) {2 A7 Y$ V5 S* j' P' J) T
try
/ H* y& N0 [- c$ Y! y{ 5 l( \, K/ `4 z9 V' p
// Enter the path to a model file! , P+ P! G% |7 [$ A3 B; j
simple.LoadModel("C:\\Models\\Test.spp"); $ m8 h$ n+ ^' G4 w
} 7 B8 Y' v n! D* J) `5 ~
catch (e) ) R- b% c+ x. c4 w; r& Y
{
L+ f. n% ?4 L8 S9 F WScript.Echo("Could not load Model!");
`+ ]& {/ Y5 ]0 B4 B( i# z WScript.Quit();
8 T* Z( O5 s& C& I} 1 u9 E( Q" e) c% ^
' ~" {4 A2 M' ^- K6 \try % f, B, }" ~4 U( e8 t
{
- }' x; A1 z5 J4 a( J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 j/ Y1 F& h# a' t' x
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! Y7 J% W3 C( S+ Z" \
if (r == vbCancel)
7 d4 A, {% Y i% @/ G { ( x$ Z. U# b9 Q$ i
simple.CloseModel(); * U) t6 N s; {+ o8 T1 y
WScript.Quit(); ( t- d& ~: Y/ e6 `9 H0 _7 _# p* G
}
, g& M6 p$ ]! Z} % q$ D3 ~3 _8 J
; g6 N$ ]; _4 z. W0 N2 x) f, ^# j$ C
simple.StartSimulation(".Models.Frame.EventController");
( ?3 {( a2 o/ i+ F, g; N; t
+ V" \; e) Y7 I, Q1 qif (simple.IsSimulationRunning()) 9 q4 ?/ h2 U* a4 I4 O
WScript.Echo("Simulation is running!");
& R/ V. I$ s# c/ r4 r) {- X) E
8 g6 w4 W6 N4 e7 |3 t// Wait until simulation is finished 3 e4 k, K) F( D/ N) P( Z
while (!Finished) WScript.Sleep(2000);
% O6 G& t6 \( u' f, U
! m% i: j9 ~, V: l" u5 Wsimple.CloseModel();
( A' v# Z9 a y }0 g6 y1 I4 Lsimple.Quit();
) `( G0 |5 y$ F! U" E, c2 GWScript.Quit();
2 S @4 w Z3 Z1 A3 y, K* ~
" k$ U% T8 q1 V9 Z0 K, F / U- |% j$ A- U+ C d2 f
function RemoteControl_SimulationFinished()
6 ?1 g, T$ E9 Y T4 x{
$ s6 [6 p: H: d0 H WScript.Echo("Simulation Finished!"); |