Example of a JScript
& e5 R( o: l7 c+ C' J! Gvar vbOKCancel = 1; / S& B4 K* ?- k0 c k1 V d
var vbCancel = 2; ) J" U4 I2 O9 L: W/ I, d) _
var vbInformation = 64; 6 G! P' ^6 J, z3 y" b. d2 ?, w, d
var Finished=false;
, N' D9 V/ m1 Y( \# x+ J" t 3 @- m+ f/ G, u i6 ~. i% ]/ U
var WSHShell = new ActiveXObject("WScript.Shell"); ; e. Z$ d3 D, S% M
! Z9 y- T& T4 L( t& M) v* T5 z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 V, F3 i) F9 V+ H N
/ y7 [3 X E$ B3 W& j: O
simple.SetLicenseType("Runtime"); & l/ W M+ |$ t o
) Y4 p1 z. u" i+ j; \1 v, Vtry
; [( Q4 r+ `; X0 H( r5 ?, W; [" j{
) {7 e1 W7 M4 v) Z% W // Enter the path to a model file!
; A, ~% }1 d! g, U8 h; F; W simple.LoadModel("C:\\Models\\Test.spp"); 7 j1 Y* X* \) z3 D' ^- P
}
& ^1 u" d2 w" L _! L8 G3 ecatch (e)
; N( a/ N. }+ B2 q! v7 [& Y, v) t{ ; Y# _# U; V- G
WScript.Echo("Could not load Model!"); 8 l- ]* ]( S2 I" g; Q
WScript.Quit();
: g+ b. S5 K5 x}
) S0 C9 \2 J/ _( v' y" M8 | . k9 V. B& W4 [3 f3 q7 O' j
try 8 S" V. {3 `* J4 L, O2 y- u: f/ Y0 O
{
& s$ a1 s' O2 {. q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * [+ A8 ~9 a, F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 l4 I, [2 ~- F0 H( ]3 ?
if (r == vbCancel) ( S' q2 D( k5 S* ^4 ~: h
{ 9 J1 |1 y8 P' n9 h
simple.CloseModel(); ! x" E3 i6 d+ W. B
WScript.Quit();
L( @* o, S# d8 g+ Z$ k s }
. K2 B; r; w/ H. X( F! P} 2 E# ~2 Q3 n- V; |4 M8 w& l
/ U+ V/ ~( D' R( `! k% qsimple.StartSimulation(".Models.Frame.EventController");
7 s$ k6 n' u$ k
% n& U7 b8 S, p: l+ V% K5 j" b) uif (simple.IsSimulationRunning()) ( L. J+ o* n' U( Q* i8 \
WScript.Echo("Simulation is running!");
0 b% R4 |3 \8 j c$ t, k; F. g 0 r9 c, S/ a; Y1 P6 h5 N
// Wait until simulation is finished - \1 T( k. J9 w& [
while (!Finished) WScript.Sleep(2000);
7 E$ U8 w1 p( Z5 _3 ?# _1 M/ j
2 d- ]! q/ h% n( C9 } s0 V$ fsimple.CloseModel(); ) [1 u$ ]. K. _1 U
simple.Quit();
4 }2 `8 `) J( W' h4 N$ DWScript.Quit();
2 s: U9 N0 p( g% ~3 M3 J1 [
$ |) d! t. A$ ~( E 3 O' C3 l5 Z- K+ S: l8 C' W
function RemoteControl_SimulationFinished()
( s" c3 b$ m Q8 w! S8 {8 X. e; y{ # R$ G2 H8 b: P$ ^3 R2 m
WScript.Echo("Simulation Finished!"); |