Example of a JScript ! K* e. s* Z7 p2 \* c
var vbOKCancel = 1; / [1 D. ?0 u) B; V
var vbCancel = 2; 3 Z+ C2 E* O# W4 x9 s9 j- W
var vbInformation = 64;
$ }- x+ \; p1 |4 \+ c9 Pvar Finished=false; 1 L4 p9 G5 [6 `- `
$ X- N0 c9 j8 b
var WSHShell = new ActiveXObject("WScript.Shell");
% q* A% T# e7 s- ]9 O3 E; N3 Y ( N+ t2 N9 _8 d, f, }# \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , L1 f6 l5 Q8 v, a+ e$ Z& v; o& \( j
% u D, h' k# m5 C b# e* w
simple.SetLicenseType("Runtime");
+ Q ]: K7 y% N0 K ~/ q, m , J* U! q u: _& ] l0 o' D
try 0 _0 e$ W0 B2 F6 K
{ - B0 y+ w: _) J* O
// Enter the path to a model file! 8 a! \5 P$ h1 i% p
simple.LoadModel("C:\\Models\\Test.spp"); 4 E, j( g& w2 E4 v x
}
- Y" P# H8 J/ G! Rcatch (e) ; X$ \( P8 ^+ _# F! N* [
{ E5 w' ]" P" W6 J7 Q8 {: g r5 b
WScript.Echo("Could not load Model!"); * {( j" `6 Z( [, j4 c0 a3 {
WScript.Quit(); 5 Y" }& g, x) G0 ]
}
/ F* @( u2 ~) `$ y
b+ w# y2 z: m+ \$ Y; }6 p6 {" V* mtry 8 a& R1 M$ [3 i+ B
{
% i1 `5 g! ]3 U4 ]2 Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 |/ h8 ?4 V/ W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 G: {" C2 R) _; g* q5 l
if (r == vbCancel) ( i# n# {% }8 {! M
{
+ }+ q" x) G0 F- Q7 p& x' o6 Y simple.CloseModel();
& |$ g# T7 A( g5 V WScript.Quit(); 3 C+ s" F. O k: l. h" Q3 e
}
' r0 A0 T0 o. T, {}
6 v$ Q: v4 A) U7 H6 h 7 P: T. d+ ]5 F% Z
simple.StartSimulation(".Models.Frame.EventController");
$ N- l1 p1 s2 c+ u* L" E . v6 }* M, ~- g5 c: v% b/ `
if (simple.IsSimulationRunning()) & N& }+ E+ Q& ^& B2 c. Q# }2 S% _
WScript.Echo("Simulation is running!"); - H2 k/ O; W8 z% \8 {
2 G Z6 _1 ^- h9 G+ z8 l: T
// Wait until simulation is finished ( x( ?7 j+ H2 P
while (!Finished) WScript.Sleep(2000); ( [5 S7 K+ F1 R8 l
: d7 z* C# y7 U( ]% i- `4 J/ S% c) ^# |simple.CloseModel(); ; I! V8 m( C1 |( z
simple.Quit();
4 `& u$ r# y# ]WScript.Quit(); - U ^8 |) u8 n1 d5 r) @
" i8 b# N2 q# D, o* b
5 Y+ w* q* U' O5 Qfunction RemoteControl_SimulationFinished() : o& _$ c+ E; f4 Z m" h
{
, x( }) ~# e) d1 |" p& B WScript.Echo("Simulation Finished!"); |