Example of a JScript
' L/ X }/ h9 @1 fvar vbOKCancel = 1; / U6 D$ b- T& }7 V& K
var vbCancel = 2; # D6 O; G2 v% `& Y+ E) T0 J
var vbInformation = 64; / U/ J- V3 B) X
var Finished=false;
7 d, I0 W5 I* ?$ l2 ^2 p4 B. \/ d, Y' {, x % r% p5 y4 R. Q8 F$ m9 W
var WSHShell = new ActiveXObject("WScript.Shell"); : n, F4 F: m2 J5 N( \+ b; P
: [" V+ B* a8 H) S/ N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : G, K5 K. q3 {$ o2 g, Z7 G, }- U
* U9 m: M# y# ssimple.SetLicenseType("Runtime"); ) q! z, r4 j* J& X
" q. \7 n" Q" b" {2 t/ [% x6 `# y
try
2 w2 c6 I: A. E* I{ # U, T' p% S( L. q
// Enter the path to a model file! 1 [- s% f! Q, `" S
simple.LoadModel("C:\\Models\\Test.spp"); 3 j" {' L- l) T& q' S5 h
}
! o$ l! b R1 \0 D3 L8 Wcatch (e) % ~" u: `; @4 f+ P* j& T" f4 L
{ $ c# [# P" b/ h4 ^2 m" ^* L/ }; k" q
WScript.Echo("Could not load Model!"); ) l( e1 c% M! A7 J% G
WScript.Quit(); * C z0 F2 d9 k7 x0 @( Q8 _7 x
}
5 w( a7 f( ?5 J6 m$ F) x( ] 6 H$ ]# |) Z$ ~7 I
try
4 F* f( c/ n; w+ |{ 0 A* [$ j' a% T& M
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 F4 ~: z) O2 i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); r. O1 R. y% `" k
if (r == vbCancel)
: g! L( L+ v+ i: ? v { L% ~( V! }: \9 _% W
simple.CloseModel();
$ T4 o" u4 B$ ^2 ~. q7 e WScript.Quit(); ! t- |; l4 h2 w; ~% E- [0 l7 T" f0 _
} ) }# h7 @* F% Q" |
}
4 j+ c9 J! G- ~ P- G- J
# k1 N+ }: |; Z" }: O- Gsimple.StartSimulation(".Models.Frame.EventController");
) o, |5 Z7 [' C/ W
: S* Y5 D, @) k; c( mif (simple.IsSimulationRunning())
/ Q6 G: K/ l$ h+ [1 K. W2 r WScript.Echo("Simulation is running!");
! R5 {" C) h0 o- [6 p( P # o' W+ j) C( v7 z5 H1 N
// Wait until simulation is finished
0 V) \! q) P/ J$ [while (!Finished) WScript.Sleep(2000);
$ g2 i' N1 X; m; `# r; X ' n; F) I. d# Q$ z' z& p
simple.CloseModel();
8 x& Y6 Q8 r! b ksimple.Quit();
. Y8 C- L0 n8 ^, i& b4 c4 uWScript.Quit(); 6 E, s# _ R- T3 H. d! E j5 n, `
( \+ m2 t5 g! ]. [' Q
: S. L" b3 p1 O' S1 k3 }
function RemoteControl_SimulationFinished()
# \1 G# @( t Z# y8 [. K* N{
# E' @: \0 b1 m+ ~+ A4 K WScript.Echo("Simulation Finished!"); |