Example of a JScript / h6 u7 d7 z Y, P( Z
var vbOKCancel = 1; ( ^* N5 q9 w" K& [: Q, \0 S3 {
var vbCancel = 2; , [7 C; A x! L6 W+ m$ j9 v
var vbInformation = 64;
& X5 ^1 H: A3 ]+ _3 avar Finished=false;
/ f q% y' t- }7 x% }/ e7 \( D0 w
6 V/ ^+ {+ W& ?6 O, Tvar WSHShell = new ActiveXObject("WScript.Shell");
# j1 l5 @# a* r* i
6 D1 ]2 b& ^0 a$ G2 h( vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * p. M9 S' n! c
& u' E5 W3 S4 M8 v: }, tsimple.SetLicenseType("Runtime");
. _+ x$ c( L/ x& H. W) w 7 K* N; D) s1 _8 ?" W: K @. |9 M: p
try
& V7 v. ^; r' C/ _! I5 L! e{ ! E8 E8 s; ^/ x* J5 t
// Enter the path to a model file! * _( w* g1 E2 w# Z" l
simple.LoadModel("C:\\Models\\Test.spp");
0 |, @" [8 d2 h7 M1 J3 G} ; T0 y, d% E1 o& _/ L! V& i
catch (e) % j9 Q7 X, z. Q6 V
{
$ w# ~! N$ k+ _& F# k; C5 j WScript.Echo("Could not load Model!");
3 X8 {# x' Y) w7 } WScript.Quit();
2 e3 t, i$ A8 |9 X7 m% h} ! p) F) J" \; ^! q2 K! I
2 Y7 n; q& h$ C2 n) a3 @+ H
try
$ n7 o; D" {; ~0 R; B$ h" r{
2 V y0 w. a, x/ p' c2 M. T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 ]5 {$ I: v' B1 r- A9 I- _7 l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 B0 [! y; _; V* | if (r == vbCancel) 3 ^# \2 ~4 q- R3 v
{
! ], O, P8 d, J: P; V! V simple.CloseModel();
, Y7 u2 s- _3 i* V3 U WScript.Quit(); 6 _ `; d F, I+ ^1 ~+ J. a
}
/ c( [$ r# A! f0 @}
3 U$ H, d9 H6 `! [, b: l1 ^ 2 y, n0 c) J% ?: S% }/ t" q4 q
simple.StartSimulation(".Models.Frame.EventController");
0 E; t/ t& Z: t4 D& j + ~! Y: z! l# [
if (simple.IsSimulationRunning()) . [# e9 T- T" Q$ H1 {( v: p6 S
WScript.Echo("Simulation is running!"); 3 K: t1 T! X' s
* h( x' f# T, [1 K& T% |
// Wait until simulation is finished
5 |4 \# s0 s' M9 Twhile (!Finished) WScript.Sleep(2000); 2 d0 ~, f. C J
1 k( @# b, q* W8 o5 q
simple.CloseModel(); 1 y! G% |$ v( I4 a9 [% o
simple.Quit();
S, B7 {: k6 q3 j6 iWScript.Quit(); 1 I: ` w1 u, F7 J1 ], x
. m. D0 K7 \, {( n
, ?% ?5 s4 }/ Q9 J' V. |function RemoteControl_SimulationFinished()
Z, L# ^! `& n. K{ i8 H6 m, u) y' }$ p0 S# V" N
WScript.Echo("Simulation Finished!"); |