Example of a JScript
5 t n8 ?8 @7 ]( o' rvar vbOKCancel = 1;
2 M8 {* ?0 K" N0 k8 h8 m: ^8 {: Ivar vbCancel = 2; , U' b$ r. u, q' t* F5 `
var vbInformation = 64;
# V7 e( b7 _& yvar Finished=false;
8 B2 [" L2 @( [' U
, I3 i& [' ? l9 U/ |var WSHShell = new ActiveXObject("WScript.Shell");
6 L& B0 R5 O+ U" O7 H' K
4 o& M+ E' _5 |4 D$ r; B: xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); x* I% U* C5 N# N+ y0 |6 a4 c2 T
- B8 ~, l( |/ s% _) Vsimple.SetLicenseType("Runtime");
8 H7 N. g6 U V5 r& C5 \! O* o( Y 7 c8 P) j3 J2 b% f: W: {/ o7 g
try
% w( B! O6 ~* g6 g- ~; q4 A# \{
% C; ^* Q( \ [7 \9 b7 q% p: b' a* L // Enter the path to a model file!
' b R+ O0 S6 |% i7 ]) T/ h simple.LoadModel("C:\\Models\\Test.spp"); $ [$ z9 g, r3 X
}
& p- t, f+ g; H* {9 x0 l4 w* {( ecatch (e)
4 A3 `* A' t. ?5 M{
3 i- J0 |. P4 b: J! q WScript.Echo("Could not load Model!"); . n# |. d7 N) N" }$ z2 D1 U6 j
WScript.Quit(); % S* {+ N% V1 Z) K, d+ _+ h$ k6 T$ e
}
& E6 g5 Z' W: @5 t
8 K; W6 `" R) c6 ?try
u! c0 v1 l* @9 P{
6 n1 k7 T& |7 J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 E: k! t2 } @5 n! n# b) {) Q3 M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 W# O# K( v' |6 o. L) C% q if (r == vbCancel)
1 V* r# @- w3 N- i {
$ h6 w7 F5 y3 V; r6 s simple.CloseModel();
: W+ k' A* A& L: d8 E3 G WScript.Quit(); ' j: Q( f# B2 o0 P( m( W; ?& ^, n
}
" E/ h' G- N* x$ o+ _& m! J} 1 R8 N- w( R) O C5 t% Q; _
+ d7 v) s' q6 J+ H5 G. z
simple.StartSimulation(".Models.Frame.EventController"); 2 g$ k( b, b) _; p; @& E& v
8 X1 C/ b6 a2 w5 [
if (simple.IsSimulationRunning()) 0 |/ r( Q* \; U/ C+ y3 n
WScript.Echo("Simulation is running!");
* w6 C+ Q: b$ J! A- k0 O - T0 o% m, g3 }( u0 \, n
// Wait until simulation is finished
' A/ B4 |% ^% w" A3 vwhile (!Finished) WScript.Sleep(2000);
+ W. ?# v$ p' o5 ^ , T0 W6 t1 [/ i
simple.CloseModel();
- u& H- C8 q3 e+ b8 `6 Tsimple.Quit(); ! N6 D) F2 p" y7 k) ]) c+ b
WScript.Quit();
8 M+ E" a3 e' W5 q , \9 }: X* \2 w8 B) e5 ]
1 C$ N- L8 ~$ g* x, j& q' u
function RemoteControl_SimulationFinished() # q" N1 I4 `5 k
{
1 l; R- a+ |) X. a. J WScript.Echo("Simulation Finished!"); |