Example of a JScript
9 P7 d* m: s& w# D. ?/ r' cvar vbOKCancel = 1; 7 S" z- K2 \( K7 E
var vbCancel = 2;
% F$ \. G( `" g. y- W# A0 evar vbInformation = 64; - q+ v7 l$ [6 {# i6 D
var Finished=false;
9 Q$ d }3 h! S8 L1 ^! N/ [/ q6 Y1 L3 r & r; B6 r1 |& w" F6 ?+ W' j
var WSHShell = new ActiveXObject("WScript.Shell"); % G5 i! ~3 x) n5 L% q( L! k. D
, y R+ g3 I: r3 L! Uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( ~3 s& \- Q$ O4 S$ `2 \
0 C W# v- D1 h& G- Bsimple.SetLicenseType("Runtime");
- F4 f' P S1 U) U+ I! u: E5 O
% v6 j. Q, f' K, A6 htry 5 i9 C. ?0 B9 Y3 D4 J2 K
{ - j5 W: {+ G; q1 F7 p' P
// Enter the path to a model file! 6 t. s+ a& b+ a
simple.LoadModel("C:\\Models\\Test.spp"); # X/ \# B% `' X$ h
}
9 f$ j, k. ]) V- K, O, acatch (e)
9 a; r# h8 f& |{ 2 t8 W! A# o+ r. b# I
WScript.Echo("Could not load Model!");
$ b5 b+ A" B; y$ p/ j2 D: I3 b WScript.Quit(); M& T( \ W. T4 R" e3 O% J
} 7 H+ j; `, {( v, X+ D. h
4 V% U" S3 ]' A2 t/ ^% }7 A# |. Htry 8 T. j0 ^+ Z0 X7 k: p0 f& p9 w
{ # H' |+ l* d6 u$ |" A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 B$ O1 f+ n% R5 g. h) H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 m" N. h" o' i. _
if (r == vbCancel) 4 \, ?$ v$ S4 s8 P8 h
{ : ?/ [* w" q) c" P& l$ }7 _: B
simple.CloseModel(); 5 S) l9 ^1 r( m+ v H" @4 F9 J* ~3 ?
WScript.Quit();
" g2 l- M8 Y# ?& f0 v }
. I! Y S. a Z9 \# ]/ ~}
. S2 d3 {& Z; F+ w" p- N& ^: V
A4 F& I2 } v7 c$ n* Dsimple.StartSimulation(".Models.Frame.EventController"); # ^" Y0 n2 }5 L1 b3 R$ h
6 k- U! E1 [/ Z: aif (simple.IsSimulationRunning()) % d) n% W# k: m0 ^
WScript.Echo("Simulation is running!"); " T- ?- z$ h4 B
2 F) z6 x/ Q7 w8 B. I( H/ e' A! P g
// Wait until simulation is finished
( c( G8 ]! f& k( U, pwhile (!Finished) WScript.Sleep(2000);
% W, ]6 h' _/ ]% o6 j% a! z
: V8 Y' T8 {/ W, hsimple.CloseModel();
2 g8 V! q0 U. e" xsimple.Quit();
( Y" O, R) Q6 f$ `2 o9 WWScript.Quit();
2 L' w F# G9 S4 Y6 i4 @" } # M" t% W9 L) q/ F
7 C8 B/ ]4 g Wfunction RemoteControl_SimulationFinished() + n" l& n+ Q% _0 w6 c
{ % x& r( v0 F0 }1 [+ c# R
WScript.Echo("Simulation Finished!"); |