Example of a JScript $ T( h; H- e* L6 j$ j. e9 N w/ b& O
var vbOKCancel = 1; " [) H; ^' P( b
var vbCancel = 2;
7 A7 ?; }5 }. j- w$ K8 ~var vbInformation = 64;
) ^6 a2 w% w) `& K8 e( qvar Finished=false;
$ _; x& c/ e! T2 @( N% u, z * B2 ?) V p) O( Y) }
var WSHShell = new ActiveXObject("WScript.Shell"); # X# \% y+ _; N3 T
* Y5 w% V+ s+ L- ^8 wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 O. E z6 U$ \; x7 D) }4 z' L
9 h7 X2 g7 {& a* b7 P5 Fsimple.SetLicenseType("Runtime"); & e3 R! d0 V8 e! S4 w7 |5 h
) E) S' T# u! _* `: ]9 R% F
try % t. E7 |/ j# T& I6 w
{
5 C' c. N, e7 o. K: u6 k3 x% p // Enter the path to a model file!
0 K* c5 I( v2 _# m1 m) s+ \2 p simple.LoadModel("C:\\Models\\Test.spp"); # D" H" N1 Q& W; P6 T4 S% D# z
} % U( ]9 d* S3 C2 e
catch (e) 7 R& z2 z3 w( b3 b5 A
{
- R6 ~" w0 O* S5 c2 x WScript.Echo("Could not load Model!");
' ?5 M2 p: ~$ z WScript.Quit(); " L9 P1 a! ^# ]$ h8 x ~$ I$ T
} 3 \- n9 b; L9 N- ^
/ Q# V1 H2 b6 M+ S$ n# |0 Xtry + v- x$ {" I6 V% S' d
{
; F# @1 \- q4 V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& F/ I6 M: x2 i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . e: _6 T- S9 Y% D7 v
if (r == vbCancel)
; w& w9 @& T% @- c7 ?3 z {
! _. ~ T9 s6 i; T simple.CloseModel(); , Y; W" |" e. A. E
WScript.Quit(); % }9 e) \* J0 s" |! [& p
} 8 n% }" k) Y3 d' Q3 h* W
} , ^) Y- } Y4 `$ y$ w
9 W) p. C3 u& ~
simple.StartSimulation(".Models.Frame.EventController");
: R- c% U0 K' }7 U' r( c0 a. I2 r* }
# u1 M/ Q* y1 s2 \; F* |if (simple.IsSimulationRunning())
2 W0 P0 R( A* K7 g WScript.Echo("Simulation is running!");
0 e9 b# F8 e. b% X* Z( T ( e' M/ h& W7 t- L* c2 Z1 s
// Wait until simulation is finished
2 n3 C h q5 t; bwhile (!Finished) WScript.Sleep(2000); / Q- C6 e4 e2 E/ ]9 C6 w
8 h: c! I% g* v4 j# b ~simple.CloseModel();
8 \( d* e5 b+ g' Qsimple.Quit(); 7 |9 N" @0 a, m
WScript.Quit(); s4 i' C0 K" E7 U) j
5 [' c! P. i% I. x 0 T0 y% Q6 U, G" M9 y' m8 r
function RemoteControl_SimulationFinished() + U5 E- r/ O3 q, f
{ 2 K; l5 O8 J* |4 K
WScript.Echo("Simulation Finished!"); |