Example of a JScript
7 y* |1 m, J% g4 K1 [8 D2 Avar vbOKCancel = 1; 8 D: B: E0 q2 e; b! L
var vbCancel = 2;
7 [( f6 S5 A( o: e2 B! c$ D# C- @var vbInformation = 64;
5 s6 a* u* X6 k# ?var Finished=false;
5 e0 p' P6 p8 V% @0 A
7 B- X- w# f3 _8 o3 n% {var WSHShell = new ActiveXObject("WScript.Shell"); & u; \0 u( u) Z) F9 B; D) W
. Q" w2 c \8 ?7 {8 x6 K% `6 V$ X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 T n# O# U# r- Z6 ]/ |: ] 6 f8 h1 r! m2 o5 b; c& A
simple.SetLicenseType("Runtime");
^! {3 u" b; W) R/ D6 z
" h4 ~/ {4 y/ R8 @6 c" rtry
1 g |- G- [$ h* i{
0 r2 R \" Y% l' D) {: w // Enter the path to a model file!
& n9 p% z* X- L, s0 L7 e simple.LoadModel("C:\\Models\\Test.spp"); ; d, }9 E m% [. e
} : o* ~! G2 s1 w
catch (e)
) S9 D1 r2 ^0 ~6 y- v{ ; S; g' v$ Y# d5 ]
WScript.Echo("Could not load Model!"); 2 I; ]: Z3 i8 J7 s1 C( a( \
WScript.Quit(); ! J7 b9 m9 O8 M& s/ I) M Z/ Y
}
' Y7 F) d9 ^0 t+ \1 m. q6 v ! e2 a/ Z7 z7 y
try
4 ^1 X2 ]2 k* Y4 i{
+ V# ~: b& Y: j: I/ V8 |- j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . _: {$ W( x7 c/ T% C6 S3 A; g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 x- [& x$ X. g$ d7 C
if (r == vbCancel) 1 u0 i; d( Z/ i3 B. t/ R6 M
{
/ J8 \9 J* V3 j! i4 B# J simple.CloseModel();
, w' z* v4 c. @4 I; C& k% w WScript.Quit(); * D# T$ z! |$ @: C
}
5 ^3 B: N4 Q5 y0 y+ ~. T$ H}
, e0 ~2 S% ~" [4 B& g0 X% \ ' f9 w9 g3 h% p9 s% X% U2 n
simple.StartSimulation(".Models.Frame.EventController"); ( D8 b+ [3 D+ B w ~; N3 U1 o
3 ]2 b8 f/ A, K. pif (simple.IsSimulationRunning()) # h. o1 Y$ e/ W+ S* [3 t0 K
WScript.Echo("Simulation is running!"); - k8 ]+ W+ `; o5 R/ D# J6 R6 A/ E
: ^: ]+ u' p6 |) ~+ ]// Wait until simulation is finished 2 Q3 q$ D) W: k
while (!Finished) WScript.Sleep(2000); 2 O) A' e' }; U9 R7 S
}4 A- v# D* A$ \3 \4 ~! }4 v
simple.CloseModel(); / E8 X, M* E- M- {# `
simple.Quit();
/ x$ Q P0 z- q* R6 P/ KWScript.Quit(); 9 e: d6 |/ C" w. q' d8 ~( o
- U. s7 Q( ^0 a7 g3 b 5 v: a" I9 U; r
function RemoteControl_SimulationFinished()
- ^( ~1 X6 F2 S0 b- ]2 \4 Y{ - Z8 U5 \2 v2 X# o3 C
WScript.Echo("Simulation Finished!"); |