Example of a JScript
$ _* s& \! X* _* ^4 t8 Lvar vbOKCancel = 1; : ]! `# [! j* z7 ^
var vbCancel = 2;
% N! S- w8 Q) l3 }var vbInformation = 64;
5 G1 i% p9 |9 C f3 P# Q8 \var Finished=false;
5 U0 r* `8 S/ j! } n8 G: Y: N7 d 6 o% d" l, X. H$ A: a
var WSHShell = new ActiveXObject("WScript.Shell"); C! C" X' L) }, Y" b/ C' U. a* {
0 E1 Z8 [' H3 e6 _/ c
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 d: x5 `$ Z6 _% y
1 w# u8 x- R1 J% {) k8 ~: Gsimple.SetLicenseType("Runtime");
, Y' C9 Q! Y; a1 i5 [5 T% l D* y' ^% n, s1 F" O( T
try
. X, `7 g% z. U4 o7 _{ 5 ~) `9 O w+ }7 t2 z
// Enter the path to a model file! ( w5 P( B3 ` B/ R3 L' f
simple.LoadModel("C:\\Models\\Test.spp");
$ t e: a- |0 N8 }( h( p}
0 G& }! h6 ~! Q: f7 \catch (e)
w7 r8 a0 M8 h; m) K; T{
# a$ F. }1 }3 B v* c& o. W v$ c7 ?' R WScript.Echo("Could not load Model!"); ' y2 j( b4 ?; @. y/ b% U, }
WScript.Quit(); # U `1 U4 J; @1 J
}
4 m" s- k! |" S' d$ R8 V5 J 8 Z8 u4 J6 ]- E. K( E. Y6 e! j( T
try ! D* j3 j( B% A* |3 _: p E/ o$ m* ]
{
5 [. _% b* A: P! P# L simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " }( P3 ]. l: k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 h* w3 l3 i+ z4 y1 `5 p/ \ if (r == vbCancel)
0 j; q5 k* Y, l { 5 z0 V8 |" M, t! s" G7 l
simple.CloseModel(); 1 X' q9 E, B+ ~; L" ~# p1 M
WScript.Quit(); 7 \, `& j8 h" S4 t
} ( d& ~, y9 [3 p9 `
}
. D7 N ~0 H" c, {' }3 O# q
7 M( G+ F* C X/ p2 v( \5 Wsimple.StartSimulation(".Models.Frame.EventController"); , u, W* F& |% L/ r! [! T. y5 _; ?
0 \$ H W% i2 { i$ D
if (simple.IsSimulationRunning())
# }. A; j$ E/ u7 E, Y2 p5 ? WScript.Echo("Simulation is running!");
* y0 ?: @( E' ]- a% a7 F; g$ w 6 f5 a" C3 S; A9 n& ^1 C
// Wait until simulation is finished
; v2 n4 n# }2 E8 ^while (!Finished) WScript.Sleep(2000); - r- O; L& U) \* _2 w) S% b# M) |" B7 R v
2 {3 T" ~8 v' ?simple.CloseModel();
( t4 o0 E3 k% v1 A; x, r0 \- U2 R3 `simple.Quit();
, G1 s$ q- }0 t3 `- A( x( ~( O' QWScript.Quit();
1 }1 P! h9 ?3 L: p% J- L. C
: K7 `; t6 ^; }( n
% J; T4 H# G: _% S" yfunction RemoteControl_SimulationFinished()
* j& W# z5 b& n H. I' U4 g{
) M) { I) _0 g2 {- R$ [; Y WScript.Echo("Simulation Finished!"); |