Example of a JScript
" O) S: {$ K/ ]/ U/ s. |var vbOKCancel = 1; 1 B8 ]; [; c1 T/ v
var vbCancel = 2;
% M) d5 L3 Z/ @ @$ ?2 R7 bvar vbInformation = 64;
! V; q2 A% ~* Y7 U/ U C4 E! gvar Finished=false;
7 R1 ^4 f: @: l/ {2 A& L( N
/ h4 `4 c A1 _! o y& y% r. Zvar WSHShell = new ActiveXObject("WScript.Shell"); $ x8 z Q2 ^& f! u7 Q5 z+ R8 K
% B7 \, S& T- z3 H: J0 w+ P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & P1 l3 J2 M; y4 p6 X4 k% `# e
& ^0 ?0 z, G4 S p) q8 o4 E' bsimple.SetLicenseType("Runtime");
5 r2 x) m$ e% y3 r; P . U& B$ Z' m+ n! X, P
try
2 E- _ Y. I' P% b" p{
- |3 a/ G& o& Z7 ~5 B) V // Enter the path to a model file! ! |/ n2 e) s' j
simple.LoadModel("C:\\Models\\Test.spp"); 3 @ r, m% E) \, U, g
}
0 R( B5 l8 G3 |7 B* ~" n( B. qcatch (e) 1 K' D( _( E/ C
{
, }; L/ I2 p" ? WScript.Echo("Could not load Model!"); ' e- a9 U. B$ L8 i
WScript.Quit();
5 Y9 c5 Y% e7 L$ g* t* H) b" D}
) s6 g" }) ~1 W8 C! u
$ K" F: T7 n. _9 h; |4 G: y) Q* Etry ) @+ j, E0 _/ ?) c
{ , ?+ Q, U$ g' N2 D( u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- A. E& g+ b0 L' i* D) H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % }$ v2 i3 k6 R( K5 l# |: R
if (r == vbCancel)
: v5 \4 T6 v' K. a3 a3 `2 j, Q {
* z8 \( s9 H0 m5 R: N7 y4 W u simple.CloseModel(); m0 O/ i g9 R6 A, y& F
WScript.Quit();
$ [! [: Y7 z) v/ ?. j3 A } 9 V2 \4 ]2 j* G2 B6 D! C
} / M" C! b2 w- S( j. I1 p/ ?
8 c: D' j& x+ n. y+ b0 Dsimple.StartSimulation(".Models.Frame.EventController");
7 _2 W+ {% y6 k! P* ]9 B 8 H3 O/ l" f k+ {$ g
if (simple.IsSimulationRunning()) % @4 H7 V$ G$ Q
WScript.Echo("Simulation is running!"); 3 ~3 D2 f! A |" m ^. L1 h7 f
O! a# h+ \8 y( u8 a1 h: p// Wait until simulation is finished 3 {; p: X$ p, A1 W0 s
while (!Finished) WScript.Sleep(2000);
0 y% o8 w( L; I6 q2 s " f6 ]- N% @* E' D. e
simple.CloseModel();
, f" F. i, d. U; Bsimple.Quit(); # M. N& Y; S- a6 x1 c
WScript.Quit(); 1 J% d$ Y7 C6 P' J3 m
3 t- {$ D5 i5 c c- t / T! s# ?3 x# U- I* x; U# k
function RemoteControl_SimulationFinished() - U% d0 }4 a! b' @" n
{
6 U0 L5 |. N/ Z4 u WScript.Echo("Simulation Finished!"); |