Example of a JScript
/ q/ t3 g+ \/ x6 g/ l% jvar vbOKCancel = 1;
7 @" |) e; P1 t% @var vbCancel = 2;
8 ?% g; r. w! R0 S; A3 Ivar vbInformation = 64; . \$ P0 J- I S( h
var Finished=false; ( @) y" E9 e# Q$ l* B; d" \
[( `# Y5 n! O
var WSHShell = new ActiveXObject("WScript.Shell"); ! t& p( e) c7 W* {/ @
. P/ j6 T! D& S! A! r& H9 hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- Y$ b9 C) ]* @! B# y; }- }' h' F' ~- {
! p! v$ Y+ Y. ]+ L0 L) vsimple.SetLicenseType("Runtime"); ' L* ? W, s4 D
! F- | e! a. {$ ]try
9 E& h, k1 U7 u& t7 Y) _{
4 O; q7 T& [: x7 q& e' O8 A# E // Enter the path to a model file! 9 b7 _, s O& A I
simple.LoadModel("C:\\Models\\Test.spp"); : N2 L6 \3 M2 i: g0 j% a' i
} # Q9 Q: Q3 O+ u* a/ t# i9 J
catch (e)
& _: p; J" d! J# g8 {- n0 \{
8 W% z6 V) q; A. C# n' S% U2 v WScript.Echo("Could not load Model!"); ' G$ n9 e6 ^) g v# r( H
WScript.Quit();
# m7 ?" o+ k' q" `0 ~8 Y& \}
, w& `6 a2 M# I8 b: Q, }7 I( u 8 f$ a7 h% p% o+ l1 U
try 9 m' _8 p3 D" t% x. I+ A8 \& a
{ , f* \; H4 F6 u- ]" M$ A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % V( |9 T" g# B, L$ c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 P6 H( x' I+ s( g. z if (r == vbCancel)
, P$ W7 _7 B1 |: f4 ` { 4 s. n2 z6 `( s3 z* M
simple.CloseModel(); 0 p2 O* ^& p1 m& P
WScript.Quit();
' C# {4 e# }, Z }
2 w- z" P1 v1 w( J1 j} / W) n1 U; r1 j! H; l9 r- }
) f4 c+ R5 G5 u2 D9 `0 Qsimple.StartSimulation(".Models.Frame.EventController"); & e$ I- v5 U" s/ J/ [" R3 k L
+ J) h% {( j! X$ a6 v8 V/ ~7 U5 t
if (simple.IsSimulationRunning())
' ]: E9 x b7 S WScript.Echo("Simulation is running!");
- B$ X# J8 i$ O* C" ? $ v. d! a w* L* [
// Wait until simulation is finished ! o% k6 I7 m: J
while (!Finished) WScript.Sleep(2000);
% ]) l Q* }1 i2 i* V * d( ]8 [/ Z' H$ T$ z d- u9 U" {( x# Y
simple.CloseModel();
4 ^8 g6 g) S# l7 {simple.Quit();
8 }1 g) B* d' v# s/ gWScript.Quit();
& \ A' t8 D. N1 Y
$ L" y- I+ @* G/ h
. O z9 u. S, K \function RemoteControl_SimulationFinished()
, A. u: K, I' L. `{
% |1 i! M* D& C, t9 g WScript.Echo("Simulation Finished!"); |