Example of a JScript
7 z% Q% b! P: {0 H5 u# xvar vbOKCancel = 1; ' e, d7 S0 z! d! T% J
var vbCancel = 2; * t; o' |( i. g% {8 G. r0 R2 f
var vbInformation = 64; 9 r5 _' R) k" H' A9 |, u, o
var Finished=false; " B& l3 M$ f) F7 u& O0 ~! h
9 x9 s9 j1 Y hvar WSHShell = new ActiveXObject("WScript.Shell");
5 q6 z9 D& Z2 a' T : D" I$ `' Y& Y0 e+ |/ x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! f# M E% S! R$ w4 E: [& R
1 I0 V: W5 u+ q' X% r# _ s' }simple.SetLicenseType("Runtime"); . ~- r$ r9 u" e$ _0 f* G
& K5 T$ V7 o5 f* m4 ]( ?" _7 Gtry
2 Z, A9 I( L9 y3 Q' \{ . R1 n; P* Q$ g3 Q/ q H
// Enter the path to a model file!
1 i4 p) q& B* |; a; l2 n% \ simple.LoadModel("C:\\Models\\Test.spp");
! d R/ K+ ~+ [* f4 o5 h} 2 H& P C3 a$ B
catch (e) . D1 _$ Z. z# s# }. y
{
! A1 d* i9 G1 s WScript.Echo("Could not load Model!");
* [7 l7 t+ [9 i; g! C! j% F1 ? WScript.Quit(); 3 z- {5 i o: w! G& x5 @* V
}
- L$ R; `7 U0 F 3 Y/ `/ a, e- K
try , [7 r8 B' C) r+ Z
{
, o2 O9 K) v* Z( v1 B# O* N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) v; Z& q6 Q7 s! F3 H$ `8 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % j u! w) O+ o: I0 W( X2 g
if (r == vbCancel)
' R) J0 Y5 ?2 _3 i { / Z: o. {% }& m7 Y% w
simple.CloseModel();
4 p% C# P% f# O1 a1 H3 R, V WScript.Quit(); " Y+ H( {& H6 s5 P" \
}
( L8 Y, O$ x i% K. u} , o# ~6 G! u0 b- M- Q
4 A% ~% }; ]- v, A* S4 N: Q6 H- ~) q
simple.StartSimulation(".Models.Frame.EventController");
( `0 R/ r. N! q) p3 P8 ^ n+ U) q
4 P y8 V( a0 M8 ~" rif (simple.IsSimulationRunning()) ) D5 S4 L r* M. V: u
WScript.Echo("Simulation is running!"); ( d1 V: G6 r$ F- t* Q$ m$ w
7 V6 L1 x7 U1 p# Z: ^2 M// Wait until simulation is finished 1 Z0 l$ d0 }! r# W# [6 I4 P
while (!Finished) WScript.Sleep(2000);
* M3 Q4 l# p: V! I6 K" y
" j1 e- l7 E" D" q2 wsimple.CloseModel();
; _* h0 L/ I) ?( z/ Msimple.Quit(); . Z: C' x) A2 h/ u, r
WScript.Quit();
! [; z. U, k( Y
" @8 P7 d& }2 P4 M7 } 1 E y: d" i0 f( w
function RemoteControl_SimulationFinished() ) x4 N/ Y' ]1 [$ P4 T5 t! Q
{
2 r- L+ k0 r6 E8 d WScript.Echo("Simulation Finished!"); |