Example of a JScript
. V- B3 V. ?4 B. A+ b* Lvar vbOKCancel = 1; 9 B9 i# n( o o9 i# v) ~
var vbCancel = 2; ) W6 }6 {" |2 r$ |
var vbInformation = 64; $ F f& O0 f) s! P4 L' S- [ d( s
var Finished=false;
{) s& O0 A+ w8 X5 B( E
, T5 b/ J/ d! Rvar WSHShell = new ActiveXObject("WScript.Shell");
- [! h( |: E b* i) S
5 B# ^4 i4 T$ |# t4 |7 _var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) z5 N3 B0 R, ~9 N6 g* w
* a6 C* ~0 n( _ Y7 B$ O6 lsimple.SetLicenseType("Runtime");
7 @& N8 _, V) i4 D* i# v9 z
' B1 v( L) M2 K6 o4 d4 Ftry
* J9 A* P. } `! N{
+ Q8 U( Q! k3 R: R3 R // Enter the path to a model file!
! p0 P4 U- l. ?6 q: H7 H simple.LoadModel("C:\\Models\\Test.spp");
. |0 n" N- R1 e' H) F}
F, H7 R2 P2 C# `( n5 a2 Gcatch (e) : e9 a U$ ?2 y9 A( H
{ 9 N! i$ g$ @8 C& ~$ ^ e) H3 N
WScript.Echo("Could not load Model!");
) g7 x) Y+ f( f5 x$ u' u. K WScript.Quit();
4 V. F& t2 a$ ?* N4 b} ) W: R' v% N/ z0 U& v% {
+ ]5 ]) ^$ |! n, r
try 3 |6 O& l0 j8 `8 I! T& O
{
0 M# `* j' u1 p3 c+ r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / o3 [% X/ D; F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! |# W5 s: ]0 G- w2 E if (r == vbCancel) 7 a$ o' G z! V L5 z& i
{
& P7 J+ l; l: E; B! E2 K. N3 }) o simple.CloseModel(); , T, h2 d4 R: h* l' I) X
WScript.Quit(); / P c. N3 I3 N, H6 G" Y
} ; u) ?0 o* ~* ^* E# ?
}
$ ^! i: o1 e! D3 m% U & _: u. L+ ~. c* l
simple.StartSimulation(".Models.Frame.EventController");
- r/ Q9 h I) R( {* W. [4 [ ' o9 `" g- R. ?5 _
if (simple.IsSimulationRunning())
, j4 n7 i E' {7 K WScript.Echo("Simulation is running!"); + O) |1 f* E6 N2 @: e" a
, o3 p! l7 `3 u# c: D/ u& W3 S% L
// Wait until simulation is finished 2 q1 V! B# Z, e+ N" C k
while (!Finished) WScript.Sleep(2000); " C% S) `* H5 i2 [3 Y7 o
$ H! A, U' l+ z1 G" o, R8 f
simple.CloseModel();
5 _7 o2 ~3 X- U) Asimple.Quit(); 7 Z; s2 o: S+ V* u1 u
WScript.Quit();
( }- B* j- c2 j 3 m6 @- q7 m, ~
5 R0 I4 w. x5 I# V$ U5 G# Efunction RemoteControl_SimulationFinished()
% v" Z7 c- q4 y% g! ~1 b: i{
0 e) q8 _9 L/ f/ u+ K# a; X WScript.Echo("Simulation Finished!"); |