Example of a JScript 3 G1 J+ L# l4 e0 z
var vbOKCancel = 1;
& u. w! k5 C- R R% L1 I( @var vbCancel = 2;
4 J& H2 p9 ?, r; y1 T3 C0 tvar vbInformation = 64; 9 a% s8 Z* j+ o+ f9 }
var Finished=false; 6 u. L' W1 ~0 P, ]" E+ ]0 E
: y/ `5 l5 K! v) [8 e8 H% Avar WSHShell = new ActiveXObject("WScript.Shell"); $ O9 ?. m8 u7 U0 i4 T
1 ]: f- Y$ S: R2 ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / o; h: I8 m( }/ {
/ ^4 ?7 c$ L" [, bsimple.SetLicenseType("Runtime");
3 z7 p7 f) P$ M
0 m! |4 K. H4 D- ~7 H; |try
( n2 F! R/ P6 S2 T! a3 \{
2 m% U9 _0 L3 P# | // Enter the path to a model file! % x1 n. J I0 u* r0 R% Y! ]6 \
simple.LoadModel("C:\\Models\\Test.spp");
9 @4 m/ O P: `* }} ! s8 e. z% w# y/ ^ W5 N
catch (e)
n% b' k0 P" S" o0 z& h+ P% B{
" z* |8 u) N: M" d! m) s F WScript.Echo("Could not load Model!"); 1 ?6 m9 S$ O+ u, _7 z. G) s
WScript.Quit(); : L) f; b+ R" g
}
7 r& R/ z# f$ I' o8 J$ Q, ^5 @; A
" v6 G5 G) R( E) {try 4 f0 U7 Q/ g2 i
{ + @; |/ U# n; G- R3 E: P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 e/ Y. ^( d* Y0 o: {7 `9 H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ J) m- o+ z% X' R D if (r == vbCancel) + A, Z- q5 z, \/ D8 z2 t
{ ) T9 \1 i+ v0 ]! G7 V) C3 `4 \
simple.CloseModel(); 9 o- W; G8 u' F! P
WScript.Quit(); - w4 w* P- u0 G7 C; _
}
, g/ k3 n/ M E) J} 4 M% @* B/ ~7 u" o' O
- I: o2 @$ r% ^& c& b% F1 _simple.StartSimulation(".Models.Frame.EventController");
6 E+ d" r: P2 t% ~
4 @9 h5 _7 ?% f/ M# }5 R. L: sif (simple.IsSimulationRunning()) - u- }+ @6 Z( p, ~ D9 j5 B
WScript.Echo("Simulation is running!"); , F; P4 L$ H5 e+ S6 Q
( [: ]4 ? d4 `: @1 t% E// Wait until simulation is finished / ?6 {+ F" t: r8 ^( A/ f O5 w$ }
while (!Finished) WScript.Sleep(2000); 7 n8 u; R/ y0 {" D3 _
( V( }4 {' z- x: x* }# U0 Lsimple.CloseModel();
2 B" N8 @1 i$ g1 xsimple.Quit();
|+ _0 i4 T/ e) n/ {' G5 BWScript.Quit();
; V$ @+ n; V0 b; m/ x% W# I, r
1 D) S1 Z' a( Y$ I) G
0 { p; g* ]; A/ i8 j, zfunction RemoteControl_SimulationFinished()
9 a* x6 I7 ]5 k6 I$ C* { H: L$ z: L{
8 L0 Z) g- T& E5 J WScript.Echo("Simulation Finished!"); |