Example of a JScript
, Z6 @4 Y s, _ e4 Uvar vbOKCancel = 1; , z& U3 {4 T; G7 l. n+ w- E
var vbCancel = 2; 3 Q) S; A$ [* W/ @: b+ ]- Q! L
var vbInformation = 64;
. {9 l, `1 i( I& pvar Finished=false;
3 M5 V6 ]6 _9 K" N. w 8 l3 a( l1 m8 ]( O( q0 @
var WSHShell = new ActiveXObject("WScript.Shell");
/ U7 g1 W5 l, ]% v w
8 i2 B2 D% u: g" ^; q" Svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, b. ^# z- n) S$ X* K# C* B& v7 d
/ \$ b6 O) R& msimple.SetLicenseType("Runtime"); 8 S3 x4 p0 ^/ M2 y6 c
; a0 O9 m" R/ |/ k* ^ s! J$ C( otry ' b5 \6 D" }# K# F9 e
{ 6 T" }! V/ Q6 K2 u
// Enter the path to a model file!
4 P* v% G, ]' n' s5 P/ s/ P simple.LoadModel("C:\\Models\\Test.spp"); . c8 ~- G3 w' u; }6 B) o/ }
} 2 g k% k& ]# s; ?) d/ {
catch (e)
& w6 J7 t e; Z7 N9 M{
6 i% v" u2 E9 Y$ r) K* p WScript.Echo("Could not load Model!");
+ U. e }( R9 z6 V7 h' i& ~ WScript.Quit(); 0 K) B# p3 k! u. }' X3 R2 W
}
7 ~1 e3 |! Z, g: E$ ?- H
! o8 A+ s/ \& K! b7 P( h; k/ d1 ?9 \try
, v( F4 A: G( {$ [7 n1 C n0 M% G{
! y" n5 Z: y" ]% K+ o) U: N) e7 j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 B* c, A4 t, H+ D1 b r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 S4 |* k7 X6 j* @
if (r == vbCancel) ' }/ Q# n% c( l& c" {: n! F
{
4 e1 ? W8 x& G simple.CloseModel(); , @% P. h C' n9 K
WScript.Quit();
. X8 L. D7 O% q: d z* Y/ q } ! j. R5 U$ h6 ~8 R) e/ c
} $ }" e0 A4 F& q) n
$ k$ o- |. d) B* Xsimple.StartSimulation(".Models.Frame.EventController");
4 m% q, T3 Z% u& [# r 0 _/ k S2 `% G$ g5 [
if (simple.IsSimulationRunning())
2 h& y, R8 r8 C7 w' ~/ k% { WScript.Echo("Simulation is running!");
+ [. h% O' j) K5 D- s ; F/ V5 o" S1 ~+ h* a
// Wait until simulation is finished
$ c7 l2 r2 y" Nwhile (!Finished) WScript.Sleep(2000); 5 ^. b0 S0 R0 Q0 f2 X7 ~) |
# G: i# E1 t* ?! u) ` Qsimple.CloseModel(); * L$ g' u5 ?6 s
simple.Quit();
1 P: M0 y+ n! V8 Z o7 lWScript.Quit(); - E% Z) r0 A' d, @7 `1 _% N3 g
" T( t7 b& b$ V, V
! ]0 b& h5 H. B. Z* F, \ _function RemoteControl_SimulationFinished() " B, h2 u; I( l( y/ ]9 l1 \3 F
{ 7 i2 v( ?( p0 N* `/ P* ` U, J g! m
WScript.Echo("Simulation Finished!"); |