Example of a JScript
A, X! g, E3 @. uvar vbOKCancel = 1; 5 S [% Z; P, J+ K1 a* E
var vbCancel = 2;
) Z' l0 A" f( `4 `% c# tvar vbInformation = 64; - \" B _4 Q6 }6 t7 ?1 x) N
var Finished=false;
6 k( u- T# m/ x: M+ q
w0 M5 i2 z1 M) j% x+ [0 Zvar WSHShell = new ActiveXObject("WScript.Shell"); % K! W/ |5 p v/ _$ \
- j- d7 [& y9 {5 Svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 N1 O9 G1 s" U# H* i( D* T 2 d5 @: @+ M5 X1 U# V _/ s7 [
simple.SetLicenseType("Runtime"); $ [ u- @3 Y8 O+ M& p. B
. \7 X2 q( \( @- J: y7 ]9 w; O
try
3 g+ @* G! q+ {7 t{
0 f. i8 m2 w3 r/ a ~$ @9 o9 a // Enter the path to a model file! / ?2 ?- d9 g7 b4 e( | C3 {
simple.LoadModel("C:\\Models\\Test.spp");
' E/ ?8 m. S u} [0 \$ t9 s& p- d: W
catch (e) . ~- x5 _6 T9 K5 W
{ + V# X$ T1 I% o$ A+ p0 x
WScript.Echo("Could not load Model!");
# o: |+ v: V1 K2 Y: {' ] WScript.Quit(); " v' J) F" n: `' o, }# T. Z
}
9 w, E5 g+ Z/ W, e9 v# j7 Q4 O
" r" n4 Z: N+ _# R" ltry . S0 o7 x \9 V0 I
{ / L I: @% G( S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' W. l j4 k) y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 K6 d, Z9 O( I4 S( U if (r == vbCancel) , v- w2 W5 E) v; t# t
{ ' X& _% @9 i9 N/ @9 t4 B
simple.CloseModel(); 6 S# b# P8 R! {" k" N( E# c
WScript.Quit();
9 v$ M4 w# U) j9 I. r% b/ Q }
1 S- ?+ u& j3 i8 F. `+ s}
5 H1 |, y( R+ N- n' f! g ; z. ?) f- B& \, R* E- z8 I$ S# m3 c
simple.StartSimulation(".Models.Frame.EventController"); ! ?& F, v4 V6 h* L/ j1 V Y8 Q/ W
2 Z4 \6 f/ A, ]1 N/ K4 J0 L2 m
if (simple.IsSimulationRunning())
+ c; n* A7 ?) ^6 B& z' }9 A( v WScript.Echo("Simulation is running!"); ! E( [& R5 X% \6 T
2 L7 g6 O" y: }* @$ v$ I// Wait until simulation is finished 0 \& S+ ]1 r# d; C4 U* V/ x8 q/ p
while (!Finished) WScript.Sleep(2000);
5 |2 W; R: E) b0 Z! x- ~2 a u% O 8 n. u# l; e# S( ]4 G
simple.CloseModel(); 8 i) O# z/ z! f- d! {3 j
simple.Quit(); : M2 A% n0 |; p; F( j
WScript.Quit();
4 w; B3 l3 z M- `4 {
$ Q4 O/ }% W' ] * j4 T, W" C, g
function RemoteControl_SimulationFinished() ! Q9 X$ h, J1 R" P7 e1 j
{
6 L& q) l, t1 y# R8 c- M WScript.Echo("Simulation Finished!"); |