Example of a JScript
1 l$ ^- Y; B& |5 R% g4 pvar vbOKCancel = 1;
4 @ {! N+ s- h- r2 i+ C: bvar vbCancel = 2;
# D* m8 N6 [3 z. y' Bvar vbInformation = 64;
& b$ R: b$ [6 _3 j' S- K9 Y3 uvar Finished=false;
( r) N2 k& j) w8 M+ \ 4 J+ e, b" _1 k6 Z& X
var WSHShell = new ActiveXObject("WScript.Shell");
+ A- A* N% t) O) O: W7 S
, X( q! A5 S; D* H' H; h* v: Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 X( @& I# h$ O# g0 a% V/ M3 A 8 B2 c9 t# v; r) r
simple.SetLicenseType("Runtime"); 5 l# {2 w7 Y1 E2 {, `% O
. m: Y! a7 W, C- V
try ! ~: y5 u% H0 r
{ " m- {8 t: e: m! X7 T
// Enter the path to a model file!
: D9 p) |. j; z; ~4 g simple.LoadModel("C:\\Models\\Test.spp");
- J+ G4 t8 r3 ?' w}
0 O1 q, ^5 Q# t9 [catch (e) ! g5 c( m! }' g
{ 4 D3 \2 }' W7 H- ~
WScript.Echo("Could not load Model!"); 9 A. {' x0 U! J U: z( T3 L, \
WScript.Quit(); 8 A8 X M# t& j3 O+ K9 i. ~
}
3 f8 p$ e# a. }7 H$ q5 M
: l: k1 ~2 x7 }! p/ s& Ltry 0 B) \/ V. a$ ]2 K/ g" W
{
G8 N. i* d/ j; F( C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- t6 R6 X3 I V r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 t7 i) k2 Z( f7 x# ]/ g
if (r == vbCancel) " l2 G4 u- H y0 i8 J1 O% f
{
5 Y& V0 Y2 q- Z$ W4 D% [ simple.CloseModel();
: @6 x% ^) ^& X' S WScript.Quit(); 9 n' k1 @! Q+ o+ T
}
6 W1 D7 d0 K( G" r( ]/ s! ^} ; ?+ Z. G5 A0 K5 `% j+ P) N
# E$ h5 a" l9 I: |$ [
simple.StartSimulation(".Models.Frame.EventController"); 4 R: C* T# s5 e+ N, Y
3 N" _6 D- m; o5 ^- ]& Y- Aif (simple.IsSimulationRunning())
: B ]. B" y* i9 c8 {+ p. N WScript.Echo("Simulation is running!"); / Q, r9 ~: m7 A5 Z% M# ?
" }8 A/ c7 X' q. J3 {. S8 l// Wait until simulation is finished 1 b" K$ _7 H3 `/ n: P9 _
while (!Finished) WScript.Sleep(2000); ) q; m' W9 w2 s7 \ C
/ V9 o1 t5 w( d2 C' b6 E; \# p
simple.CloseModel(); , ]' B' S) z; S( z' H# s
simple.Quit();
# p0 z& s) B. u( BWScript.Quit(); ' ?. Q3 k7 T4 ?5 G- v: b- b( z Q
+ N* B8 J- t9 P- O1 {* W* R 0 h% F9 i" v( H) x( j
function RemoteControl_SimulationFinished()
( N4 ]( O$ f+ v{
6 E; K6 k4 F7 r) y! B WScript.Echo("Simulation Finished!"); |