Example of a JScript
" q) f- v7 v, _0 }9 Y4 k8 Bvar vbOKCancel = 1; / S$ ]" N2 r* n
var vbCancel = 2; 9 e- E) |, P7 `6 Y' J: C6 e8 {
var vbInformation = 64; . f. h) u8 i" N/ ?7 j+ m4 Z9 W
var Finished=false;
2 e8 j7 x5 g2 b 2 F+ A6 u5 x2 f9 y% ]) C
var WSHShell = new ActiveXObject("WScript.Shell");
& M' P/ l: w( x! p, C, p
, a5 ]' C0 n& a: O' yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, d# z9 R3 m; H% P6 v: z & t5 P% k! j8 z4 L) K4 [
simple.SetLicenseType("Runtime"); & `6 s) e# q) Q& Q
, @" S, F0 u4 k, M9 J3 I5 B
try 6 h" L" \( H0 G
{
& `% s, }3 w1 u& c5 Y // Enter the path to a model file! ' A* {% l7 n! _- O0 P
simple.LoadModel("C:\\Models\\Test.spp"); 8 ?$ a0 \! r/ S" y0 `" d8 v3 a1 z
} 7 z6 i m1 e1 s0 ~ J0 B" D- B
catch (e)
3 Y2 h1 L: k+ `) T$ P+ M1 j{
! P0 z: t5 G1 Z6 t, O; R7 r; y6 P WScript.Echo("Could not load Model!");
( J) {1 @8 ?6 F5 T3 P1 C4 x2 r WScript.Quit(); - W$ l5 {% w- x1 T9 Q7 v
} 3 F/ o; T6 v. q3 w* Q
/ O( q' w3 |0 q4 o; A' [try * |/ U: a M. {" X o
{ ( W7 \( f" v) p3 ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( W# |% P+ ], }4 k$ B7 f% D, P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 ?" a& Y$ V/ M `( k/ Y6 a if (r == vbCancel) 5 F5 K/ [# @% W. ?
{
& A+ U5 ^, V- |3 `( P7 u% r simple.CloseModel(); % G& {3 {( Q, g: {
WScript.Quit();
- r; N1 i# O4 g- o/ s0 r }
1 S6 x& g0 K9 A} % }: \/ Z. ~ [- L# F! F
* d# m) m( U: F. G. ]8 `simple.StartSimulation(".Models.Frame.EventController"); : j5 f. W' l8 Z6 G9 l) ?* b' {* E
$ c! i) ^" d0 v& I3 C1 G* d: ]5 cif (simple.IsSimulationRunning())
! s1 N* K6 W1 ?, r- w9 b WScript.Echo("Simulation is running!"); v1 H0 W# ~& @1 h/ s4 J
! N6 J8 o; d" e# Y- f$ c1 ]' h// Wait until simulation is finished * i$ ^( s$ T1 h& t0 t1 X
while (!Finished) WScript.Sleep(2000);
$ V0 j; ]; }$ b! g3 f+ G3 K
, H5 q/ b9 W2 m R# Tsimple.CloseModel(); ( X8 _- ^6 E; D+ f D* e7 V. G
simple.Quit();
' v8 d' G x/ H. k, a( Y: e) X3 s6 pWScript.Quit();
4 A2 i7 H0 }$ W* T+ m6 G2 w0 V8 s$ I $ L; ? ?/ M3 F$ _' d6 f$ f
7 L. a' X, G: M& t' b2 o- B& Nfunction RemoteControl_SimulationFinished() $ }' G1 s* j& R1 F8 `
{ - {% P4 e% C/ i! b+ r- ?6 R
WScript.Echo("Simulation Finished!"); |