Example of a JScript
- f, m, e4 u" g2 W8 Wvar vbOKCancel = 1;
1 K' }" j B3 ?. U) nvar vbCancel = 2; + Y# A! f; ~, H5 G
var vbInformation = 64;
2 f7 M3 w' o1 T# h& Bvar Finished=false; 2 s' I: k( P7 a" |0 R
: K' l h) i( O
var WSHShell = new ActiveXObject("WScript.Shell"); 5 h6 V1 \7 z1 m. h
' \, J" M) A" T4 J: e/ G+ |- k1 Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( o1 j8 ~% [& A
7 @9 B9 N; q; v: [simple.SetLicenseType("Runtime");
' I# F- D/ a; {& v$ p8 T' A7 P: N 0 S" n3 L% A; i1 [7 c, p9 h
try
F- a' q! r; m. C, d2 p{
- i+ j1 b3 P' a( X2 g0 U# O // Enter the path to a model file!
2 F1 A8 Z- J6 `# m) G6 { simple.LoadModel("C:\\Models\\Test.spp"); , P( K. z0 F" N
}
/ x/ b9 D: N3 U- ], _6 [7 k& r ccatch (e) " O; _9 R! L. X9 [# `- h* B0 S
{
2 _6 N# O) b7 p' y; ~% Z1 X8 S WScript.Echo("Could not load Model!");
2 {/ w1 n1 j1 D WScript.Quit(); H9 w& k/ k2 J" O3 j
}
! I* z8 O Q( u7 w + ~! `+ R. Z/ T, P
try 9 f# l2 X, n3 l0 e: v( @7 y( S
{ / t" ?& J: k: x! ^8 }- z q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 r2 L: y1 o; I: K0 L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 K1 j8 l3 m# W# ^. X& ^ if (r == vbCancel)
& H, t$ @& v3 W0 u& S* c' s {
; H+ t* E2 N z simple.CloseModel();
1 z1 Z% h+ @ H: C- \% L0 U WScript.Quit(); 3 m; N: L# O% i/ [1 n6 e m# x8 Z
}
; m' u" D/ y5 \1 B} # X7 O/ T2 h8 g/ \6 D" g" u
. |5 M% V( v, Fsimple.StartSimulation(".Models.Frame.EventController"); % ?& |4 _4 Y/ Z, w) z
- g/ |+ X* S# a1 R" B# |+ Lif (simple.IsSimulationRunning())
. a, H* X2 S+ w( C& [2 v4 V WScript.Echo("Simulation is running!");
* S$ t7 u7 x p* T6 o0 v$ X; v1 L
( R7 P) ?. e( m! S6 h' d T5 r a// Wait until simulation is finished * c; i+ i' T( P7 [4 K' o' I7 W$ k
while (!Finished) WScript.Sleep(2000); 9 c4 j" z9 i# C# h9 ?
% \( O: S: l6 t0 w9 ^
simple.CloseModel(); / |/ y( o$ x& Q3 w
simple.Quit(); 4 ?2 d" ?- k$ k" J6 h( Q* d; k
WScript.Quit();
' { W7 y, t! G! n
5 b% s7 B/ k' \; c5 t+ x0 j 3 V. \- O" P) R
function RemoteControl_SimulationFinished()
6 H; a6 S/ C7 s: G1 }1 M* y{
# K8 [8 ~, r. W) |9 O1 X WScript.Echo("Simulation Finished!"); |