Example of a JScript
! }) C3 D. C* X7 Bvar vbOKCancel = 1;
5 f: l# }0 F9 |" I8 n! D& Ovar vbCancel = 2; + E! B6 n! n+ O5 C8 s/ k* s$ }
var vbInformation = 64; 9 p" Y; R: b. U$ \) o; J
var Finished=false;
) q1 v7 k9 O9 a/ q, y G
3 `, u1 c* a/ x4 ?- qvar WSHShell = new ActiveXObject("WScript.Shell"); 4 ?$ y/ _) C5 L# z* y8 n& Y
- K- @) Q' k: F' i7 m! j" yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) m) D7 V: b1 v+ y 9 }/ g6 ]2 _) ~. p( v5 G
simple.SetLicenseType("Runtime"); 8 E+ A( d9 S+ L! [+ `$ d
4 X# z! O. Y- x( A H, Dtry 1 o1 {. B" R! j4 D/ ]! q. r
{
* B$ B& Z6 e4 u/ k // Enter the path to a model file!
% }1 T/ Z. @ i/ l. Y simple.LoadModel("C:\\Models\\Test.spp"); $ h! Q& k% @3 v! Z9 ^3 B
} 4 b* v' N5 l2 K9 ?. J
catch (e)
. T: [3 `& o5 A! ^/ f{ ; J8 Z- X) T6 `+ \$ Z$ N, x1 V
WScript.Echo("Could not load Model!");
: F3 E! O+ y, h& Y$ I WScript.Quit(); " G, G, o2 M4 m
}
, a- R4 f( H7 `+ {4 Z 3 Z& }6 B. Y! @% x1 v
try ) ^8 H W) O$ S
{ - ~$ K& Y: t( r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; g2 }4 o* U4 c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 |' j4 S! M3 Y! [. u# T& A
if (r == vbCancel) . F# q2 x1 C) ^; Z) Z% K
{ / M% \# r4 C6 K1 \$ V, C
simple.CloseModel(); 2 L! Y, c% o' g0 f; l, V
WScript.Quit();
* j& Y: U4 W1 d" Y% Z/ l }
2 R q. I" k. H/ I; r; X' j5 K} * y2 j& d0 U j
5 y) H& b* s4 m! K3 W" F+ n! Jsimple.StartSimulation(".Models.Frame.EventController"); ! h! c( C; c) o5 g1 g
) [( q; c9 l: W8 ?6 J- ^* r3 xif (simple.IsSimulationRunning()) % L6 X/ f) W4 g
WScript.Echo("Simulation is running!");
3 E9 F& v# m/ R8 b! K5 ? & W# t/ C4 h0 \$ ?) g
// Wait until simulation is finished
9 n9 g: p0 Z3 U# q, `$ Lwhile (!Finished) WScript.Sleep(2000); + D: r4 V, X0 X4 g' C
6 y* b% x" p2 T7 E, Z! b$ X& E
simple.CloseModel();
h( t& z9 |" V3 Msimple.Quit(); 6 N! F( H2 I9 i* S" D( ~3 d1 c
WScript.Quit();
* [; [& h! R, c7 i/ I 0 }7 l# b' ?# D' c
: B. P6 a" z! A6 |4 O% \: @
function RemoteControl_SimulationFinished() - x/ M" n% S! Y. M" }* R/ F* @
{
5 f% u& r' r* l5 n" ~0 g WScript.Echo("Simulation Finished!"); |