Example of a JScript
$ K2 M/ D* }, a+ ~var vbOKCancel = 1;
. c/ O+ x* z1 jvar vbCancel = 2; & b+ E3 v Q) L6 ?+ T4 ?6 A
var vbInformation = 64; 9 n/ g. [0 N9 U9 o
var Finished=false; ! R5 u; T* M% E
7 \% T6 p* B0 |8 J$ Dvar WSHShell = new ActiveXObject("WScript.Shell"); 0 K0 s" {# j0 A. e* s# F0 j
- j2 Q/ f7 _0 K+ ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! r. P" a) u2 A
+ k+ i; X% V& A% z% G$ u5 [simple.SetLicenseType("Runtime"); 8 y& r( ~' Y: d
6 V" n* M6 U" J
try
$ s+ q+ _2 u# b# U1 W{ % |' `: B+ S/ I( n- `" H
// Enter the path to a model file!
% \; q1 K7 b; {0 j$ k# F9 ?3 M5 A4 l simple.LoadModel("C:\\Models\\Test.spp"); & s4 u0 z# `7 y: J
}
* ~& i! z8 W M% ^2 mcatch (e)
$ {% [" z! W3 K* ^) Z! g3 P{
% J9 _* [- v* V& ]. K2 s WScript.Echo("Could not load Model!"); ! W* t7 _: H- `/ C, x! D: v/ Y
WScript.Quit(); 0 F2 }6 S% F. d+ c
} % j& j8 _# w0 P. Z6 I/ n
3 m7 H) h2 Q J- mtry
3 D7 l) P0 m( y{ ; y% X# k, `9 p6 x" d3 w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 x; ^/ u. Y7 {* n3 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 Z0 G- z( w9 V
if (r == vbCancel)
0 O) R* C- H( V. S, q1 c6 @ { , t. B1 s, P6 ?$ M
simple.CloseModel(); - l3 d/ f7 g7 ?7 c8 f
WScript.Quit();
4 i4 G- b; f) H9 A7 f } 9 ?, u/ r$ [/ U: I
} 5 O# K& b, N! ~* P1 A' w, a
- f6 {, f, n3 g
simple.StartSimulation(".Models.Frame.EventController");
7 X3 l; S# Q \& j/ c! h/ |/ \/ c
4 x! v3 J1 R" c# v6 Tif (simple.IsSimulationRunning())
# I- S/ j8 ~6 u; j0 O k WScript.Echo("Simulation is running!");
3 M- [) t& \1 c
% j! G$ A. |* S$ L// Wait until simulation is finished 6 @5 \' X% Q7 H; |6 e
while (!Finished) WScript.Sleep(2000);
) n4 p/ t7 S; S3 l$ \
, j1 o* x2 @5 B% f0 Y6 A' Isimple.CloseModel(); $ l: d7 X% N1 O
simple.Quit(); 9 G) a7 S' ?" h
WScript.Quit();
8 [/ ~/ G; q& Z! f; i, c
4 G4 m! J L7 ]- G* y 6 d$ d0 Q0 m5 O( ? e
function RemoteControl_SimulationFinished()
& M8 \, n1 ] |9 H{ ' Z& r# V. B! W8 H3 o
WScript.Echo("Simulation Finished!"); |