Example of a JScript
9 I9 W+ J- F' u0 Cvar vbOKCancel = 1; ! B3 `( @" T; o
var vbCancel = 2;
# H% s. i% p/ a& f" y: {var vbInformation = 64; 9 w' x! |: `( R
var Finished=false;
2 N9 f9 S& }6 J# L* D
4 u( t1 j C, s. ?+ ]- e( J2 Ovar WSHShell = new ActiveXObject("WScript.Shell");
' \" m+ q( L; d; |2 w 7 h4 \5 Z" v# p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 e: V* Q# V, _* a0 l# G % J9 F! G n* i/ q8 n8 [/ [1 ^, E t# C
simple.SetLicenseType("Runtime"); : q' M8 U* m; J2 g7 V: ]/ N4 ^2 V
, t& Y. M7 h$ c! t
try
, {1 f' {8 D) f( M V3 ?{
' i. \- o- r. [$ h- D0 i) u( V // Enter the path to a model file!
1 H9 B, N; U1 {9 p ~, f simple.LoadModel("C:\\Models\\Test.spp");
: `9 [% {5 F3 ~, R) B; s} 5 |' h. Z7 h, U* j4 _# S( ~$ h
catch (e)
& e" H4 m* ~# Z- j0 n5 c# J{
m+ G4 s, {. B5 a3 M1 Y3 q8 y WScript.Echo("Could not load Model!");
! f5 g8 L6 l$ i) m/ [ WScript.Quit(); 0 {8 ^: D$ H4 `. E
}
7 y* P, r: A4 X . w8 H7 s) g' y! ]* X6 e5 M6 Q
try
8 f0 \, S. i( _: _% I{
8 D. Q* Y d* V. x1 D/ _- R$ Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( P* D+ m& O; D! F# N. _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ C: `& s1 l1 m& Q6 Y' c, S if (r == vbCancel) 1 ~, n8 b( q) L6 \& w. A
{
8 k; O) W" D8 [0 q- N simple.CloseModel();
4 O7 `. l- {& W1 ~2 h9 G* I WScript.Quit();
3 H; r+ O7 u/ R# V }
' G. a' c; i2 ]* A6 a. ]) q5 d/ n} ( P9 |" k7 ^" E7 T- _
0 @' g1 G: c _
simple.StartSimulation(".Models.Frame.EventController");
( c7 p: M0 O# K5 g& d3 g9 R' N4 n % V3 [! w: }- {! U3 ]) u+ B
if (simple.IsSimulationRunning()) 6 X) _" d% `3 l% O, G, _- |2 n! Z
WScript.Echo("Simulation is running!"); 7 k! k! o$ L9 ~6 v
5 G2 i7 A2 r# v+ f) x8 p
// Wait until simulation is finished 1 U9 q9 J; u6 u. @
while (!Finished) WScript.Sleep(2000); . B& V( _" _3 h
. f) O& ^2 P( m! b2 xsimple.CloseModel();
, p# w1 i f- _simple.Quit();
B0 F+ `! z. D: Z9 g- {WScript.Quit(); : q3 I: F& `) [. p7 F: W
3 L2 r6 h* q0 J4 Y$ L, e. Z/ h/ k
j/ z% o9 s4 W7 O3 X! Z8 l5 ?3 J
function RemoteControl_SimulationFinished()
$ F8 f; I( J( Q5 I5 n2 N{ - m2 ^& U& [+ [5 d0 A
WScript.Echo("Simulation Finished!"); |