Example of a JScript
( ?* w# k. E, }* ~2 rvar vbOKCancel = 1; & W7 D- E2 ~# T) V1 s
var vbCancel = 2;
4 p& o* H: ^9 ^1 |. |. w3 j- a2 q4 Lvar vbInformation = 64;
7 R. L% k6 F" w, g# p+ \& wvar Finished=false; . a! Q- w! v' Q
' B" U$ ?, D! `8 C* i# i5 J
var WSHShell = new ActiveXObject("WScript.Shell"); % O4 w$ G U& S3 q9 e
( h' }8 d0 P/ X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: G2 d5 z% k4 Q; P! Q 4 Y) }" E, m& O
simple.SetLicenseType("Runtime"); , F5 D4 m$ G6 f, B0 ~8 u& o
" a* W( {. ]- E7 Z
try
. ^$ x' x" J4 G{ + h% `! q) F( Z, O( l3 {# c
// Enter the path to a model file!
$ b5 @: B& v3 y( j3 P3 l) k0 _' q simple.LoadModel("C:\\Models\\Test.spp"); - y0 [) s; ?0 m7 V, n+ m4 w6 I' C6 ~2 w
}
8 B2 }& ]! Y8 A f, ]9 h+ d' Tcatch (e) $ f: E6 N( W t0 y
{
3 u! Y+ r2 m/ v3 {* m3 f WScript.Echo("Could not load Model!"); ( G$ H' \2 V, g$ H' G5 l
WScript.Quit(); & E, `/ S, T" k: R
}
# f7 x. a! a) q$ i4 p- ~* l
; F: R! `# I3 I* [0 f) K+ {try % w A4 m5 R: H- I; y
{
2 R- H8 j& M& k8 d3 S0 n, L simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + H8 v4 Y6 R- F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' N l, [6 c( @* V if (r == vbCancel) 0 J% U u# j c0 A
{ 4 x; B" M- ^: h' P
simple.CloseModel();
0 U: \9 h& b0 h# g- E WScript.Quit(); + }5 T1 w& h; `" Y# h
} 0 h$ b+ w0 O4 k8 T+ V' U2 B; V: K" z
}
: H# h; d% `: M! i" b
5 U9 ? @2 O7 ?1 k# usimple.StartSimulation(".Models.Frame.EventController");
6 {5 ^- I$ S8 T3 ~8 J% t 5 K/ t/ H* \9 c* u5 Z0 o
if (simple.IsSimulationRunning())
' ?5 V- M6 x; x$ ]7 P WScript.Echo("Simulation is running!"); / h, U( D& \/ k5 T% i
/ `5 i* j# ~+ h" B' z
// Wait until simulation is finished
$ [- N2 C+ {; j. L- I3 |- ]while (!Finished) WScript.Sleep(2000);
* T! h3 o ^, d) {2 ^, q
; I. h( N7 Y; m* e* esimple.CloseModel(); ) J. y( I% ]3 B$ r8 e; L2 `/ \
simple.Quit(); ! q# y. ]$ E* E5 Z/ z: C
WScript.Quit();
4 t0 x1 z+ e/ @" J- | ; t) X1 I$ j& @1 E3 M @/ u& w
3 m7 h- C% b8 x
function RemoteControl_SimulationFinished() $ l e+ f# f5 `. {+ h
{ 2 O' Y5 {2 c; `0 v) Q9 C9 g
WScript.Echo("Simulation Finished!"); |