Example of a JScript
" [8 z3 m b; \) _- v5 Gvar vbOKCancel = 1; " |) F- ^# W/ V
var vbCancel = 2; : v9 E, p( Q6 T/ v
var vbInformation = 64;
1 d6 }9 J5 z* m: e. G# }# X) j9 dvar Finished=false; 6 j- o. u: r2 G% @% a' S( F
( _4 k/ S( U1 g4 s9 j
var WSHShell = new ActiveXObject("WScript.Shell");
7 H* ~+ x6 \2 Z/ a3 ^' f ! w) Y9 r9 M# ~% |( w @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, r: `* y4 I- O! v8 k 8 s& h6 W( g- Y
simple.SetLicenseType("Runtime"); & L& ]0 Y2 `' _6 y
% [3 l+ f7 w) E/ @' r
try 0 @- E/ ~" Q3 [7 ~5 |, B7 I
{
% P7 @4 n$ }& J: {4 c0 n6 b( o4 e // Enter the path to a model file! 9 X1 x, d1 x0 O0 L5 g' n
simple.LoadModel("C:\\Models\\Test.spp");
* Z1 ?' e8 b W! ^- W4 N) t. h} : N5 w/ o; n* c, s. O
catch (e) 3 B P6 U5 I- r5 i
{ 0 c) V2 i/ L, t% n
WScript.Echo("Could not load Model!");
- d1 O- `; U/ }6 n* q; G$ y WScript.Quit(); 3 y) ~1 g5 m5 O- W- ^
}
7 A5 {! @5 g, A2 u S: A: o4 s
! ]1 [' L- g1 E) H# A5 ftry
, G0 g: d/ @9 l( \4 T4 B{
( F1 L& X, V% d7 ~, H% L simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 {# ]2 m% n) d4 ]: F! `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ T, p2 ]3 n4 M, |0 C# ] if (r == vbCancel) $ P& s+ `: H" c, |* q
{
% w+ P/ ?7 j+ O) Q5 t0 Z2 w simple.CloseModel(); 9 i B' s- S' l
WScript.Quit();
% M& _% Y& ^! ?1 M9 p6 ] } # m" ]: ^! H) [" c
} : @5 s3 f% @( T. X; O8 q: {
; J! T: { T+ e
simple.StartSimulation(".Models.Frame.EventController");
. i' ~5 Q- F9 |5 ?# l8 S! t! _ 4 \+ E @ V3 B- N
if (simple.IsSimulationRunning())
& `5 Q% P' R) r: P WScript.Echo("Simulation is running!");
) \1 N* {6 E% l # Q8 T6 v. ]( H( R' k% x
// Wait until simulation is finished ) |3 v( ?" |) R
while (!Finished) WScript.Sleep(2000); . H4 d9 ^7 p6 V, y
4 `, g% T, L+ h, ]2 k
simple.CloseModel();
" f: p( @' k9 b! D( {$ _simple.Quit(); 6 r+ e/ k0 ^6 O* U( V
WScript.Quit(); ' K0 _+ {& C9 I# ^! s& Z$ w
) \! f. [9 N O3 K! s( d4 Y0 T
" b) m) I }2 @2 y5 T3 y9 O6 {
function RemoteControl_SimulationFinished() 3 ^) t, Z, ^( k* z1 [1 Z. a; A8 I
{
p( M! y5 L4 V/ d WScript.Echo("Simulation Finished!"); |