Example of a JScript
7 o. d% G$ s5 I) f# Lvar vbOKCancel = 1;
. j( S, m8 t! t# T+ y! I0 _var vbCancel = 2;
' D5 e) i$ @2 W4 zvar vbInformation = 64; # A( o+ P( V' V; p1 G
var Finished=false;
+ s8 g8 L8 ^# I; d
( s. X# ~2 z% I) T$ bvar WSHShell = new ActiveXObject("WScript.Shell");
/ ^) ?3 l7 r6 C
9 r7 V7 l4 C- g2 c; f0 W( S& X+ y/ vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 O! _2 j5 d4 [# j" M. C
# c& {0 }( Q& p0 V, F! `5 z7 }& Psimple.SetLicenseType("Runtime"); 2 y2 ^ ]( z6 N j
2 o! i5 D0 Q7 F, _/ Z" A" r
try $ a' O' n( E2 T: {6 x- g; k
{ : u6 j5 M8 W) _! v
// Enter the path to a model file! 8 l4 d3 }3 Y9 S x& W5 M7 M0 F! ~8 G
simple.LoadModel("C:\\Models\\Test.spp");
4 N! n& a* d% r5 F) S}
, d+ H$ z, X/ O5 mcatch (e) 1 m" O- v* n B# n Y0 {
{
5 i! u1 ]- o0 ]8 | WScript.Echo("Could not load Model!");
( y1 m8 _9 ^ }- [* B WScript.Quit(); - G, p$ b9 \: L: y; m6 A8 m1 J$ b
}
* e8 k0 Z" q. \, Z( i : i4 T- S4 c$ r
try 9 j g( G/ g: |' i: E, _
{
" ~2 u/ F! c3 V; [1 B" i, S simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + t5 `0 ?& V6 m1 G, n
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" S1 J0 J9 f6 V4 }9 V% @ if (r == vbCancel) ( X' o* {" Q) E; B9 w3 j
{
+ N, L0 @4 S5 M' t( M. M simple.CloseModel(); 1 n* z! k$ h( u! ?
WScript.Quit();
2 h4 E6 _ T/ n. J/ P8 \: i- N8 O }
0 D$ n$ y" M1 ] |: d} 3 u! \ ~7 R& j1 y, _
! p4 b8 X1 B! e! q. Y9 h
simple.StartSimulation(".Models.Frame.EventController"); 1 k) K6 @2 q Q1 q; x
8 t: b9 v! x! _; w" H- p
if (simple.IsSimulationRunning())
9 E* p6 {/ e. Y J$ W: c4 H- T WScript.Echo("Simulation is running!");
3 P4 c' E1 G: f; e; b 8 a E5 Z2 ~) Z7 |' Z
// Wait until simulation is finished # s/ L0 i( D% k0 J
while (!Finished) WScript.Sleep(2000);
# K4 ^# w9 F9 d0 q8 D8 R! ]8 K
, b, x: c5 r3 |) C. x1 c2 B7 [( jsimple.CloseModel();
4 c% x& A3 E! r9 c- Isimple.Quit();
3 _, R# S& X b5 \. h) IWScript.Quit();
- h) j# c% r9 a/ S% O - ~* L. J& |4 {
$ H6 c/ y8 B% V5 Y9 t- D
function RemoteControl_SimulationFinished()
# g7 W! o$ d' i9 K! v" _; Y5 W" c{
( d% R: Y% K4 j7 J WScript.Echo("Simulation Finished!"); |