Example of a JScript : q$ Z S% j) H( A3 x
var vbOKCancel = 1;
& k: ^6 \5 b8 cvar vbCancel = 2;
4 b9 }6 ?& Q% }2 jvar vbInformation = 64; / n2 S6 {' o: G# c ^( Y* c8 ~
var Finished=false;
" B" `! V( S% O4 j; b2 D - j* @. }4 w, n N' d3 t
var WSHShell = new ActiveXObject("WScript.Shell"); + _: r+ a- h3 a- s* o2 y+ z o( P
: x+ _' K; R! g- i- I" ]. W2 Q gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 \$ t1 l! h; t& W q
8 V; D$ O4 |& v: X0 [7 E
simple.SetLicenseType("Runtime");
# f+ [7 k6 p1 n8 b6 ^) x
. t [, c0 i/ H% I y1 I3 Mtry
+ C' d- Q4 m! a( f$ F7 C{
d, Q' f1 d$ ` // Enter the path to a model file! . G2 \# m9 |2 x* r$ s
simple.LoadModel("C:\\Models\\Test.spp");
7 L- g% j6 S& ^}
+ F% H" p# H% g/ E& ~catch (e) 1 Z' @9 ?1 a. C: S' o
{ ! q% W. O3 N& }" o _2 t
WScript.Echo("Could not load Model!"); $ V5 M! `' O* I- v
WScript.Quit(); ! w; V) v7 T# G3 n8 C; d9 @( N" S
} 7 H' F( K4 J) n& L4 J
2 C# z: K3 _" ktry / H( t; t3 j8 I3 y8 F' p/ q: p6 h; H
{ 1 t3 _3 w' z1 O
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 }) c0 }* C: u+ Y+ q: G6 O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 n1 |8 U1 [3 B+ Y; u Z) R8 |
if (r == vbCancel)
" D5 i N% J+ K w" A {
- ~& v+ G# V, }* J% G: X simple.CloseModel(); 0 [7 z% ^- ]9 K& A- t
WScript.Quit(); / Z1 g* W2 p4 q$ \2 A" A' d( a- X
} . Y: o1 d+ V- F) }
} 0 R& M3 M7 s% s2 X5 I
, w& M& d# d) }# a) R$ X- O% }9 Tsimple.StartSimulation(".Models.Frame.EventController"); ) F: G! A3 `( x: w+ u0 r
* S- T$ `2 U" [& f, I; t5 A0 _; n% F' vif (simple.IsSimulationRunning()) @1 V* U4 p( Q# w
WScript.Echo("Simulation is running!");
. r# U S' R- f& @4 _ $ R5 _0 l5 i6 x, R
// Wait until simulation is finished ; |5 X$ \) h" }8 C& e# Z$ I: y! y
while (!Finished) WScript.Sleep(2000);
7 n5 S& ?* a5 E0 U- t* H B" i8 i7 \
' e4 p0 i; a+ P: Z+ g! O* ^simple.CloseModel(); 0 q5 q' ]( H+ }/ @7 ?
simple.Quit(); ) f4 Y2 R* e A3 c# j5 r1 E# I
WScript.Quit();
& m+ Q* ]- w# z
. M* n' Q* D M, _& H/ G
+ {3 H0 e2 k# I/ i3 T& d0 dfunction RemoteControl_SimulationFinished() + L) ^! B4 h8 t
{
4 I' a, Z+ l0 x$ X WScript.Echo("Simulation Finished!"); |