Example of a JScript
3 p+ U l1 r9 Y5 e9 f- Evar vbOKCancel = 1;
' v( Q& Q, D4 {" D. m0 O/ u7 T Zvar vbCancel = 2;
! g, [3 O5 |2 m' q- a) p+ z0 k! Vvar vbInformation = 64;
8 j9 g8 Z7 c7 O2 R4 `var Finished=false; 6 `" j3 [- p% c
: r* O7 x: _5 Y+ C% z7 t, Nvar WSHShell = new ActiveXObject("WScript.Shell");
8 d. a {- I2 Z7 l! ~: Q( a j 3 `0 L! i& m: [ }; O! p* i+ d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 f5 r6 S! g, Q; J3 ^+ }, m @) q7 |# h2 E) U
simple.SetLicenseType("Runtime"); , M* E$ R$ d0 d: T9 p. X& i7 d; y1 ^
7 \8 H1 M0 ]$ ]6 `. Jtry
4 t" Z( k( a+ W) K{
% t# m. ^5 E2 |3 ?0 U0 |- C // Enter the path to a model file! $ O1 c& a2 x+ P) K* @6 }2 B. `. [
simple.LoadModel("C:\\Models\\Test.spp");
o$ T' t! C+ B( ?; i! R- C}
+ Y9 ?0 R1 q4 L8 z! @catch (e) 5 \$ N5 d+ f0 A0 X
{ * S/ e: X* \; Z* Q6 M8 E: F! d
WScript.Echo("Could not load Model!"); 2 e3 T! J/ c& w! |( B& A
WScript.Quit(); & C. A" G9 \; ]6 N
} . f5 r. {# j; D6 m5 E1 J8 ]
& c# S# ^+ V3 ~- Ltry + D7 _: O6 I2 _0 ?$ M
{ 8 e4 W6 E* j; p
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 P8 V# |2 t8 H; r8 i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 O- U8 D8 p( }$ b- ?
if (r == vbCancel) / R' e* Y" g8 g/ g* E+ V2 n+ f
{
, T* G1 v% u& N$ l simple.CloseModel();
# i2 E; S4 U8 {( |# j b4 `& r WScript.Quit(); 1 ^4 }, j2 w1 X! M
}
( y2 B/ }- i. c0 ?& `$ c} 2 m; t8 {5 B; M7 c) m0 v! w, q2 R
5 C* W% F3 `$ O" F! X) ^/ Jsimple.StartSimulation(".Models.Frame.EventController");
+ X: L7 P3 \* ^2 @- d4 G
3 b0 F' f$ U9 I8 e* mif (simple.IsSimulationRunning()) & Q' q9 b( \6 \8 R
WScript.Echo("Simulation is running!");
( U" | l# N$ u+ a5 [3 l- ~ 5 I2 Z& F9 r$ V9 o8 ]" k4 Q
// Wait until simulation is finished 1 }, l9 S8 E( s% O' o5 t: e
while (!Finished) WScript.Sleep(2000);
1 b/ E" E2 K' I$ m/ F
$ d0 Z! p- v {9 y1 k" Vsimple.CloseModel();
- Q& g5 \- a7 S0 ~. O& ]6 j, \simple.Quit(); 1 F! p% G: c9 n& _& e1 _
WScript.Quit(); # q0 F% I# [" h) z& |
- H1 z$ }, h; Y& O: C
. ` y& ]- u* [ Tfunction RemoteControl_SimulationFinished()
$ v! \, n, w% c+ N* V{ - A* `6 ]% \9 ?" S7 q/ M5 w
WScript.Echo("Simulation Finished!"); |