Example of a JScript
- A2 w- l2 l! n( \, c8 w" C( ]# Gvar vbOKCancel = 1;
& S V- D. h; mvar vbCancel = 2; F* b2 S) O0 ?5 a+ A5 W: Z9 I( _
var vbInformation = 64; : ?; z' p3 Y+ m6 i( v4 ^
var Finished=false;
7 j. e8 t( o, b8 G w% J 1 W) b6 B% s* h
var WSHShell = new ActiveXObject("WScript.Shell"); ( A' J: ?- \/ } l- D
2 A" [: r# ~ O$ F4 k$ Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ P1 M7 `/ i" ~; f1 _: i# k" k
) e/ j# f9 F3 p4 ]- e7 F, }3 ?
simple.SetLicenseType("Runtime"); # k3 g+ r3 F0 W8 E
4 S7 U' \) f. ztry
$ g& v: z0 O/ _1 |4 J, R( ~4 r: [) A [{ , _6 ]" F. V; J6 j! |
// Enter the path to a model file!
. ^% o3 j5 {# H" w% ~6 P# x" F simple.LoadModel("C:\\Models\\Test.spp");
2 M' W& w3 M8 X; w! l: l}
* p0 \8 o% \ U2 r' m) T4 Mcatch (e) ]$ s2 }: ?/ J& D# h6 i; P' {
{
6 I) L8 F/ R2 K! O0 D0 x WScript.Echo("Could not load Model!"); . ]& n- g) h' s0 }
WScript.Quit();
1 t( I- c, U* n" _: t} ' c) ]& U! ?* s3 w- l4 ^
, b3 S$ v( e$ U1 H( m. ^1 O
try
n! U6 o. V# c& S7 {6 _{ - L( n5 [7 i6 {+ i5 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ V9 o4 ^0 u3 C& l' }4 I D8 R r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 x+ M& J+ O. R
if (r == vbCancel) 1 W9 X& m* f. ~( w- [
{
7 I: }" {0 B |* ^+ [ simple.CloseModel(); & z" j* g; E4 J- s
WScript.Quit();
# p. M0 l# X6 P9 X } # P0 i- a. z6 Y/ S: g& ]" s4 ]+ A
} . Y2 Z; x# H4 Z
. C+ @; v3 t9 | K9 o: ]' m$ p
simple.StartSimulation(".Models.Frame.EventController");
) |0 T0 l/ Y/ p3 T ) Y' T D" z# r2 c: H7 l
if (simple.IsSimulationRunning()) - ?+ M) A' o6 t" X% ?2 I0 b
WScript.Echo("Simulation is running!"); 2 k; Y- r4 \: L q
U# W2 D9 }) J3 c
// Wait until simulation is finished ; j7 i& Z* e+ l9 D
while (!Finished) WScript.Sleep(2000);
% O4 ~; Y$ _% ?7 F 8 Q+ l2 n+ y* g' p
simple.CloseModel(); 0 U( D$ o5 U# G# ~ C; {/ }
simple.Quit();
+ R: Z, Z' O1 h! `, }3 mWScript.Quit(); 1 M3 f" @% ?" P+ E( R& \
7 y G, H* S$ E k7 `6 n
- l5 a1 j& x* y( p/ n) ^5 b
function RemoteControl_SimulationFinished()
. A6 k! d$ f/ i- Q9 `# l{
+ s4 b; R' ~5 ]& n- c7 b! J. ] WScript.Echo("Simulation Finished!"); |