Example of a JScript
, P; s/ E) o) f; rvar vbOKCancel = 1;
/ l* o* f+ c; K) c$ }var vbCancel = 2; 8 [7 Y' H) ~$ p( Q
var vbInformation = 64; % l! M8 _' Y( v" E
var Finished=false; 8 c0 ` u; N2 U- K* `& k
2 e7 ]4 [* w/ C7 @var WSHShell = new ActiveXObject("WScript.Shell");
3 {6 |0 \) A: Z3 P* k/ H8 m
: T. T$ F+ S& {# h$ Vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " C, y: Z0 `9 P: h
; t' y% Z+ T* a3 I. A
simple.SetLicenseType("Runtime"); / m3 I. D. B1 f
- p8 }* B1 ]4 \
try
: H/ g i# X# u2 Z/ s1 M{
' ?* r$ s1 j3 X0 Y' i: D2 c- V3 P! P // Enter the path to a model file! 1 H* V& K7 O3 q0 Z0 [
simple.LoadModel("C:\\Models\\Test.spp");
A7 Y o6 T+ }% ~0 ~& }; i& J5 y9 ^}
3 ^: y, \. y- h' j3 O! i/ _' Rcatch (e) % t2 E& K1 I0 Q1 `
{
5 r/ [: t/ |+ K9 [* Q8 Z8 n) O WScript.Echo("Could not load Model!"); & ?; |9 f7 E m. E% q
WScript.Quit();
2 w1 n0 q; ^: z @( m6 ]* }! E' L} * Q$ W8 Y6 p9 [
, A9 @6 E% A4 d
try
3 ?( d( O0 c, \( m{
) a6 K# S: F% @+ |2 y! O6 p% W2 P+ R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ U/ H! s8 t( ~6 S/ L1 r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ c/ W. V% j4 m$ N if (r == vbCancel)
( y* d6 S1 ?3 v" Q7 v: D { 5 N6 r1 L" m; a0 g- Z
simple.CloseModel();
& c0 N3 y& c) d: U8 Y$ l; G WScript.Quit(); % \- H% W5 D" N8 q+ l6 ^
}
3 }* s# A; }5 Y} 5 v3 m! m, ` _/ n' r1 I% R
. H1 O6 K5 h, N# H8 Zsimple.StartSimulation(".Models.Frame.EventController");
8 h% K6 X; ^, m6 \2 U' b
. I8 N+ _6 @/ lif (simple.IsSimulationRunning())
4 X8 E7 q3 |$ Z; W/ d/ X; f WScript.Echo("Simulation is running!"); 9 E0 P- C% X3 v' K
4 b: V2 ~3 |1 }" E m7 }// Wait until simulation is finished 9 m7 A R! _ X3 `6 H
while (!Finished) WScript.Sleep(2000); 7 l3 u D( R2 {! u, s
: d: {* p3 r% _# i- p) P
simple.CloseModel(); + m. N- c+ D9 d
simple.Quit();
, N% P( R2 i! P0 XWScript.Quit();
5 l$ l: r- B' i- ^4 T$ R |6 j2 z 5 S: e/ \3 J9 V' @+ Y
/ ?( ]$ ~2 a" x2 l) ~5 d8 Rfunction RemoteControl_SimulationFinished()
! [& l1 ^9 j; H( n9 L{ 9 h* i5 }: y" ?2 o' s- w) X4 m
WScript.Echo("Simulation Finished!"); |