Example of a JScript ; U) F$ G$ y0 a9 S1 T7 P
var vbOKCancel = 1;
& f* i, l- M1 o! Q/ y5 qvar vbCancel = 2;
+ t; u* e3 D" Bvar vbInformation = 64; 5 t0 K1 J1 N9 ]7 O
var Finished=false;
8 O5 z/ f7 S. J 7 e: J5 C# J* i$ W6 a2 ^
var WSHShell = new ActiveXObject("WScript.Shell");
5 B- b" s9 g( d( P2 S 0 ^1 E! w$ i) }; D) N; a2 {+ \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 U. G3 h+ R; l: n% | @4 e
( M, h7 C# l0 M/ l1 K) Usimple.SetLicenseType("Runtime");
& l2 c9 X( g' C1 z. D4 }
3 o1 S( t( I' T( f. E6 e) D9 r& _6 Atry & V8 @. f9 U! n( Q3 u4 w! M" t( C
{
4 F+ |2 d; y( a/ ~ // Enter the path to a model file!
2 q4 j& A+ W( k* R! u6 x- F simple.LoadModel("C:\\Models\\Test.spp"); ( u, i8 r9 U7 ]5 e. O0 ^
}
" g: E Q& l! A/ K, ccatch (e)
# S: Q/ ]# X, Z" {# N4 c0 b& e& J( F{
- T' ~# F& z' L; \ WScript.Echo("Could not load Model!"); 9 O, m7 a: t F& h* E5 `
WScript.Quit(); 3 k0 H& p$ x5 J5 \
} K) W ~; t) v; u+ F4 k
6 n1 o( c0 x2 P! C* d6 J7 H4 \
try 3 G, n: ?0 F9 ^; Y' |& k/ M; \
{ ; h# N9 N1 ~& D( D+ o1 x9 g
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 s# F) c# A& h3 ~8 U! z" | r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 }3 G! x$ e* g, t# K1 h! \ if (r == vbCancel)
/ p0 j' @+ K5 L1 B {
# w+ x) J+ P9 f) f( A+ W% N simple.CloseModel(); ' A$ x& t0 |- K/ I. c# r F! d) \" ~
WScript.Quit(); + Y# j8 P9 r7 G
}
$ X9 I8 P' e3 M2 I5 w9 M} - f* w8 F, A/ G% w3 M
, S7 }1 h, K# E# Z
simple.StartSimulation(".Models.Frame.EventController");
. _2 `1 q+ D6 `( d! Z6 @; x; s# c 9 ~- s- i" U f" @2 A
if (simple.IsSimulationRunning())
$ v# G0 P! x! i- @ WScript.Echo("Simulation is running!"); 5 Q8 t: l$ h4 E& e6 O( \# ^
9 p0 y- ]9 F/ ~ U' D// Wait until simulation is finished 0 G# S: V9 d/ P7 C; `! h) c
while (!Finished) WScript.Sleep(2000);
0 [( ?& f& C5 J! @! v2 U
@' a% L6 `2 \8 Rsimple.CloseModel();
r# w) J8 a4 p7 m8 ksimple.Quit(); & N$ a8 ~/ z6 ?( o% i) }5 f
WScript.Quit(); # `2 [) G, S; F( M+ w
1 h5 Z- R3 o2 K% u e
1 L6 F) u0 K4 Q- H6 X' a- \4 U. jfunction RemoteControl_SimulationFinished() / A1 v% A3 `$ n) e& P
{ x2 u/ N5 ]' H/ r
WScript.Echo("Simulation Finished!"); |