Example of a JScript
9 o- n4 K; I" V, L @, avar vbOKCancel = 1; & {# r+ ~, o2 i l& X
var vbCancel = 2; / \$ P0 _0 C5 b
var vbInformation = 64;
3 k! K# |7 N# h) `var Finished=false; * Y% z- T8 N/ j" P5 }; h
4 L& w, d% }' L
var WSHShell = new ActiveXObject("WScript.Shell");
- p4 U& g# n* D2 v1 F
# m7 G' z2 }+ \' pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : J1 m1 W8 j! S
. |2 {! Y& [( Osimple.SetLicenseType("Runtime");
, S: _; Q; V8 n5 O y7 c8 r7 d9 G: f5 T$ x# w
try P1 B4 o" T C# z7 k/ f
{
- t5 B& U6 _" E) B8 U // Enter the path to a model file!
2 V1 V! T A* m2 V simple.LoadModel("C:\\Models\\Test.spp");
, C- A$ B F: h% f} * n: P% `4 ]; t5 s
catch (e)
. @7 L- H# j @& i$ Y: N! C{ 4 Q* j$ \/ A6 V8 }6 q3 ~: z; c
WScript.Echo("Could not load Model!"); 4 u6 O) K p; e) A6 l& q; r
WScript.Quit(); + c& t7 T4 G7 [3 B/ F" a
} ) t* x' c7 t2 D0 p& n9 a
- F; u( V6 y; s6 D h
try 9 k) e7 s+ p% G
{ 0 e: H( \$ v( n( O
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 O; S9 q% d5 J. f; g. h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ @! _4 u. G: G) m if (r == vbCancel) 2 ]9 V. i' i0 x* [; p: W
{ u0 P* b0 H8 y0 w9 m1 f- h
simple.CloseModel(); 3 y1 Y" K! r4 _8 Z2 E3 m7 N
WScript.Quit();
1 |( N, p" P* k9 n6 N2 w } . p8 ~1 m L+ X! [0 c+ I
}
& K3 ]. c8 F" _+ T7 Y m' H* ^
3 W% H2 `# y4 j" Z; lsimple.StartSimulation(".Models.Frame.EventController"); # q' R; J4 c t3 G$ `
& Y/ m0 n3 ^; Q: k
if (simple.IsSimulationRunning()) , F1 t5 o v7 f" A' _4 |6 G
WScript.Echo("Simulation is running!"); 0 y; }+ G: N5 A8 d. t4 m
F- Z% K9 L7 \$ R' b/ G8 m: }
// Wait until simulation is finished 2 `$ p9 B+ z5 s# n
while (!Finished) WScript.Sleep(2000); * i; U3 b- d5 x- S- J
; ^/ I% ^; Q0 |5 ^/ Z/ _simple.CloseModel();
9 N6 w2 a. i. ?5 }. N+ ]simple.Quit();
5 J; K% u0 |2 M' [WScript.Quit();
9 E' u5 y2 \& H1 n + x4 N( I/ f* l% C$ ?
; c- \/ t$ D/ Qfunction RemoteControl_SimulationFinished()
& E9 {1 N5 T) U( l* h{ 7 U2 f E4 D: U2 M1 l+ x7 E
WScript.Echo("Simulation Finished!"); |