Example of a JScript ' i% g8 Q) |: D% V5 O
var vbOKCancel = 1; 3 D8 R& s$ r" r* a
var vbCancel = 2;
* |% J; X8 o' G# ?var vbInformation = 64;
- y! d! p9 J! V5 ?8 rvar Finished=false;
. h' ?4 ?2 f! T; }9 k, {) M : x/ z- k1 k1 n0 M! T+ y
var WSHShell = new ActiveXObject("WScript.Shell"); ' v7 k' r- U3 j o; q
' l$ j$ ?4 Q1 B( j7 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 D# I1 {0 W( Q
' l4 x) S6 e" y% @" hsimple.SetLicenseType("Runtime"); 3 |1 ?) T8 `9 T
- q0 I4 |* Z! _' F6 L2 h7 L
try
+ k7 ^& G- O/ z. z{ J/ o; B) Q; ^: Y6 l
// Enter the path to a model file!
& s3 V9 k- S* y' O6 N* I5 M% F/ X simple.LoadModel("C:\\Models\\Test.spp"); 7 q: ?$ s# o; Q( P% V' g- T
}
+ m3 e% t% S8 O/ _catch (e)
! f1 p& P8 F2 L: T$ O4 m( M/ |{ ; B2 _ {+ m& ?# c, k
WScript.Echo("Could not load Model!");
- s2 n3 ?+ p6 n% u% a. y WScript.Quit(); ! ^) c( V* K& _3 D& B9 T, C; E
} / z8 H1 G; ?6 A: p/ f7 n( Z3 i& {; E
. K) Q+ ~$ V3 A6 u" _: I+ t) Stry # E& o. H' L9 B0 m+ [
{ 2 a4 n7 n. [# c2 f( b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " [7 q. ^, {! @ A8 R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% M5 s8 I9 e( T) \. M+ p6 a* K4 c if (r == vbCancel) A0 ^0 h4 x) P4 p# l% |0 T
{ 0 [+ t8 B# [ }, R7 x [
simple.CloseModel();
: k! T8 X: }4 ^8 P7 o, x) C' I) z: F WScript.Quit(); 3 E7 H( I4 D8 q& ^7 G* T4 ?% `
} ; {; ^: q2 c* u7 Z5 ~4 F9 s
}
0 U) Z" d. L4 @. |( M; {5 @ * i3 K" R) b! z3 q: F4 c
simple.StartSimulation(".Models.Frame.EventController");
: s0 S/ w z: n# c% z, h
" }+ q1 D* u) d. v' Jif (simple.IsSimulationRunning())
* X/ Q8 [' {! p. w) c/ {' B0 s WScript.Echo("Simulation is running!"); " B, N+ R; e" g' r( s8 f0 _3 F
( J" }5 F4 c3 z7 |3 R
// Wait until simulation is finished
, z! s+ p0 O9 X9 D% ]2 Rwhile (!Finished) WScript.Sleep(2000); : y# a( d+ w9 P4 j6 q3 M9 [
( q% E' c# |, q, w
simple.CloseModel(); + ` M7 _0 I: `& A2 I" O- F6 M
simple.Quit();
" ]- v+ M0 \$ `+ {WScript.Quit(); & C% f) A1 @- \5 V- E5 |
8 ^: Z! _: T' y6 |; h" Q4 D
/ y; q% R2 b4 l! t' vfunction RemoteControl_SimulationFinished()
; H' d. Q# Y5 _/ ?) X1 O' C{ 1 |0 Z: R0 a) {. f1 w
WScript.Echo("Simulation Finished!"); |