Example of a JScript
% {2 Z+ c) t0 _' vvar vbOKCancel = 1; 2 ~- \# U4 [1 {! _
var vbCancel = 2;
$ ~) S" B. C1 [var vbInformation = 64; ; g7 N `- {! E! w8 ?# B
var Finished=false;
2 w/ x, M7 B' V6 G* [7 u1 i / `' C! X0 Z3 t h4 c( O
var WSHShell = new ActiveXObject("WScript.Shell"); - n$ L, T1 z7 C- |. o1 }
/ d+ `$ E, Z3 y/ @1 a M, _4 ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ j8 o1 ?* H5 }6 r, S6 F- O9 b+ v 3 M% f- x' z: p z
simple.SetLicenseType("Runtime"); 9 w8 C& a9 l8 o
% q/ x2 K' ~5 N8 a* ltry
}: y% {# f g# r2 U2 S{
& l& L9 A( B* @; c4 E // Enter the path to a model file! ) ]1 N) Q" ? R0 j6 N
simple.LoadModel("C:\\Models\\Test.spp");
! f% o8 o0 y) d} ( N; `2 @! j5 e- \7 k. B& }% S
catch (e)
+ ~4 W* }9 k! X" N{
6 q8 {: P8 h+ Q% z WScript.Echo("Could not load Model!");
, _0 B/ V4 G( a6 D' p WScript.Quit();
% ?# B, B7 A% t0 W& q# ~$ ?/ o}
) x$ `+ H7 u& a) m" C ; ]+ x" y" I- F; Y% L* A
try I) r9 V! ?8 }" o# B
{
z+ X& X6 |9 q8 W; Z/ i8 Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % Z1 M1 C7 z* O2 E$ G4 f0 I0 o
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 ~$ p8 ], y+ W* ?" N& ~4 t
if (r == vbCancel) ' _5 C( k z4 Q+ s' f' N# E
{
4 o5 P. ~/ _" g( V3 Q- w0 _ simple.CloseModel(); . L* a/ ~; a$ w8 P: k4 U6 f
WScript.Quit(); ( q& a0 t% F! J) s/ d/ I' K) z# N, x6 z
} ! y# y. s9 X7 @, A
} + b+ R- C: `/ H) c& E' u! F
9 m. D4 E& u. l9 J# U2 q0 qsimple.StartSimulation(".Models.Frame.EventController");
. N, a1 g6 L: a: I" u! v6 c
4 N+ v& T8 j/ P6 ~- Wif (simple.IsSimulationRunning()) 6 {0 `6 j; X, D* B/ J& K
WScript.Echo("Simulation is running!");
$ S$ c5 V# k4 ?; {5 S' E9 y& O
/ S& p6 l: Z/ D0 }- g; v; h// Wait until simulation is finished $ ~8 R* R/ B+ R2 A, m
while (!Finished) WScript.Sleep(2000);
8 u- ^& n* Z6 w
* v1 z" R! M+ @. G2 nsimple.CloseModel(); 1 h1 p' \# D" Y( }
simple.Quit(); , X" q2 @2 ], e
WScript.Quit();
( `$ _' g& `. a3 s' i- i; v1 l/ ~
- p" {: s; A$ `: d/ t" n( I3 V6 D 7 k& T+ j' z. s2 X) |
function RemoteControl_SimulationFinished() . l; `1 x" c" P7 Q% ?
{ . U/ q/ B1 D" L
WScript.Echo("Simulation Finished!"); |