Example of a JScript : \( h4 U2 s5 Z& J) K6 W
var vbOKCancel = 1; " l' o: z$ h: ?5 z6 g* t
var vbCancel = 2;
6 y' b1 {4 b( u/ S/ B+ ~ Dvar vbInformation = 64; : U; v" J3 x& w) [0 ^+ p+ r
var Finished=false; 9 x/ E' L. P' b* j5 R
) j! m w ~; ~# W% R$ h" cvar WSHShell = new ActiveXObject("WScript.Shell"); 3 S2 `- Z% E9 [' V4 j
/ Y3 I' v! d2 F. u) X6 bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- P. ]$ n- o1 v7 Z+ z
2 g/ [ I# ~; E; H+ v5 usimple.SetLicenseType("Runtime");
7 ]* P" L+ b+ R9 | + f5 T: c! P! A2 h o: J. i
try & e- }5 a; d* `8 V% p
{
) c6 m0 Z4 i% u // Enter the path to a model file! 0 W) e# o4 }3 C* d* c. S$ ^
simple.LoadModel("C:\\Models\\Test.spp"); & r7 v" W7 _: b$ U$ a/ H% r8 u
}
, s. e7 g: m. k5 Kcatch (e) * i( s& g' m! u7 Z' m2 G, |/ {
{ ( |. U/ K! T2 Q2 b! z" R
WScript.Echo("Could not load Model!");
0 j4 }) {/ P5 d/ F6 P. ] WScript.Quit(); & x+ L+ y' X9 R6 i! |$ e0 z
} 4 d- f7 a. W: S4 t5 G
$ Y" k( |4 C9 S7 |+ h6 U
try 2 \6 W4 {) i6 W" {$ w0 @
{ ' D9 i! o* {4 [
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) M# N3 ]) O l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 d; \1 x/ P* z0 H9 k$ o# p- D if (r == vbCancel) . m4 U* \! r5 `* U
{ * a1 a5 }# _, D7 E& l5 m
simple.CloseModel(); + g; N1 ?) e b3 p
WScript.Quit(); : s+ Q" Y: X+ h9 {7 r$ d4 |0 z
}
) g F1 w$ }4 C U/ I}
9 l/ w& @) V; u4 x6 t' \% {- @
2 d- `) i6 B9 w$ osimple.StartSimulation(".Models.Frame.EventController"); * \5 a; D2 g8 V4 e1 h
2 y L; \5 @* B2 ?: _$ J# ]
if (simple.IsSimulationRunning()) / S$ m7 }; e+ B3 X3 D- J
WScript.Echo("Simulation is running!");
- B/ g8 |2 n9 e* m 4 E6 `0 a0 R' Z4 Q9 Z" C
// Wait until simulation is finished * F1 p$ K1 W1 p) V2 N9 A
while (!Finished) WScript.Sleep(2000); 3 {" s5 J! p9 N# g8 z$ x$ @
# C- W) T+ L( b( z
simple.CloseModel();
" Q! D; K3 A5 Hsimple.Quit(); - U8 d& L( F" W6 K
WScript.Quit();
0 @) K, p0 z/ d8 n+ _+ \ 4 A7 l# m5 `. _' J4 k
. Z/ z) q1 E& g$ r% ?3 Mfunction RemoteControl_SimulationFinished() & a5 ~3 [$ ^ {8 H4 c
{ 1 X* K- s4 P' N& M- q# O6 h
WScript.Echo("Simulation Finished!"); |