Example of a JScript $ A% y6 Z0 p4 p! g0 K) t1 d T5 V
var vbOKCancel = 1;
4 `! Y" e! L" U+ g- p5 r+ e5 |var vbCancel = 2;
Y4 o4 m3 I) e' Z6 Yvar vbInformation = 64;
) s, |+ _5 h/ Lvar Finished=false;
" @% i+ t% Q: \8 B& M- V+ }6 E9 m
6 b; I3 V6 m( x; _var WSHShell = new ActiveXObject("WScript.Shell"); 4 E4 \1 T5 V# U+ o2 j, R
5 i8 G& ^9 n0 I# L8 v E. fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* ]# |3 V9 }) [" Y0 R) e: F
3 ?( f, ?! h$ n% O6 Osimple.SetLicenseType("Runtime");
9 K4 [' P7 k6 s# Z / Q9 H* f+ l) U
try & U& @/ D O6 i. j9 Q8 e
{ % i3 o$ _# ^, D' |8 H( N1 D* x
// Enter the path to a model file!
: ^% X9 G2 } ]" n simple.LoadModel("C:\\Models\\Test.spp");
* p- Q8 p6 E6 @0 @( j+ @/ {}
5 V. _/ V8 j, k1 E+ x0 Q) bcatch (e) - U- P4 O/ [9 f$ @* [( r. P+ E9 A
{
5 a) J- _( r1 Z WScript.Echo("Could not load Model!"); * J# z4 f& n4 o6 t5 g/ Q; R, P Q
WScript.Quit();
* {; `2 K$ p$ C}
* r" c. V" R8 Y6 z9 l
& J' K7 C" ~* V: l6 utry % [* R% r- a* ^/ X$ o9 F
{ 4 h( r8 X- Z; I# j/ o
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 z- n7 ~3 J! w3 B+ e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " `( M0 t; ^ b3 O
if (r == vbCancel)
3 G, _4 i) k4 ~; v6 r5 i {
* I2 B/ A$ ]* l) i6 R+ _, Y" ]/ r" o simple.CloseModel(); ) n0 s" ~. c5 i
WScript.Quit(); ! x- X% O2 |* k6 ]1 b8 P
} $ Q' ~) F6 [. V
} * ?. Q7 R, S2 m9 G9 i! B" r
, p( r" G- a# Y. j# ]4 E
simple.StartSimulation(".Models.Frame.EventController");
- z. F: s' f& U. o, G/ z) n+ l* ] & @# d; D+ T0 A9 }& l
if (simple.IsSimulationRunning())
' M" Q" h, h. X d+ {- H, m WScript.Echo("Simulation is running!");
8 c/ F4 s6 ?6 o. ~+ f' i) J
# |1 _/ H3 ? G: R8 D+ M// Wait until simulation is finished , B6 B! p- E! E( ]5 I/ B
while (!Finished) WScript.Sleep(2000);
' n/ n6 s/ ~. A; u0 F3 n" k
4 |. Y9 R& t/ p$ E) {$ t2 ?simple.CloseModel();
3 r/ y0 n% @0 X4 l' @ k& h" vsimple.Quit();
2 {6 a3 z( [" K( `# J6 ]- kWScript.Quit(); ; @- e+ v U3 N+ T- D
5 z6 G6 t1 z/ e1 |: w
# Y- _8 [! b: N" A! f0 Y7 Pfunction RemoteControl_SimulationFinished() d! I1 ^+ F5 z/ X. t
{
$ ~* \4 |, y" w. }$ [/ [2 D WScript.Echo("Simulation Finished!"); |