Example of a JScript
% @. J$ h6 N2 E- w& }var vbOKCancel = 1; 8 M2 R) [ j+ H+ V+ G( z* I
var vbCancel = 2;
b2 K9 V, ?/ J/ _$ c' M* Zvar vbInformation = 64;
4 t, E" T2 w0 ]; o& e/ c6 J0 Cvar Finished=false; ( A* j7 O" U& I! }
- j8 a! u0 F4 U% X
var WSHShell = new ActiveXObject("WScript.Shell");
! h' Q8 {. e- T# C 2 z( i4 B6 B/ y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 G0 s( B" {# A: t! L% Q; K
+ O D. l+ H: \1 k2 Esimple.SetLicenseType("Runtime"); 2 c! r, R# D* D& o# r: P
0 I7 S+ r# ~ g) ~! p3 i* Ptry / m; L8 _* I0 h: Y# U
{ 7 m+ Y; \6 B8 w2 g4 l
// Enter the path to a model file!
i. f4 N2 t3 b* M8 W simple.LoadModel("C:\\Models\\Test.spp");
3 t0 ?6 Z t( x2 [- v1 N1 Q9 g} , Q4 o" S: r. K4 k) ~
catch (e)
. j2 X3 G8 o# s6 Z7 O{
% ]$ W0 }7 F5 c# i$ _ WScript.Echo("Could not load Model!"); ; W. b: C* i. D$ A8 \8 D/ E( u
WScript.Quit(); ( k9 e% B/ g0 c2 s" d- x; v; s& f4 j6 i
} 9 g! f7 K( I* F: |# U: W, k
( G# l* T: M' M
try 7 m, m9 } H K: A$ S; K- g
{ 2 X/ k% @$ A! R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
L' S1 j* }) q6 F r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! P- j( C$ t5 t9 f
if (r == vbCancel) ; c S! p: A) S& g- i7 r' I
{
2 _% Y. Z" k( M# a/ x* E, B0 v simple.CloseModel(); " s3 d9 c! u7 H# F9 X
WScript.Quit(); & q: j7 s+ p9 N! j# H' c
} $ z( B* G# o) v4 f$ s( }9 _
} ; {+ M# E" l3 t# O9 H5 X; H' N3 {
9 ?- X3 [$ ]( g7 ~* }) t% t c2 N
simple.StartSimulation(".Models.Frame.EventController");
: V2 H% Y9 Z' c+ |5 I; q. u $ K5 D- E9 G, W5 r- {4 Q
if (simple.IsSimulationRunning())
5 j2 i0 k( D3 J u& } WScript.Echo("Simulation is running!");
) ~# X5 j! b3 O+ V& n6 Y - A+ }5 U$ _) |# k$ e
// Wait until simulation is finished 4 o8 O, i+ ]& S H
while (!Finished) WScript.Sleep(2000);
9 G1 q/ n" Q% A/ M3 x9 g, s( T ! I/ r" m9 E( X
simple.CloseModel();
, B; c* N1 k( E; W, D7 O& b) ]simple.Quit(); 4 L9 o9 ]6 U+ c$ z7 L m0 X
WScript.Quit(); 5 Q5 _" [ B! F3 ?/ c% j, X
, g( X; ^: q( U0 R" ~7 J1 \ 7 ]5 K1 P7 G* i" {
function RemoteControl_SimulationFinished()
* T) [0 J; F+ _# k h& Z- I- L: f{
- i* w. x8 O! Y6 d WScript.Echo("Simulation Finished!"); |