Example of a JScript 7 p' J" x, e3 o6 z- _
var vbOKCancel = 1; * f4 ]% T% j2 F5 ^' E2 J# B
var vbCancel = 2;
! ~8 n0 K; |$ I! }5 ], ^! yvar vbInformation = 64;
( a; [& ^. N4 Z- t* `: Wvar Finished=false; . z3 {! q4 o* U! _
# G. }5 r. F! o; b5 u( Z' |$ ]
var WSHShell = new ActiveXObject("WScript.Shell");
9 T4 c# l3 L' s) \% R/ }# \
: K! p7 J' k$ ]6 ^9 Q# g8 \( q0 Pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( S$ u g- D1 y/ ^& f! H 3 ^0 i' W& T8 `
simple.SetLicenseType("Runtime");
. F, K( _, w3 N3 K( G5 w' t
3 |) M8 p. y o% htry
3 k; q+ H: A8 p( I k. l{ ( r* `7 c/ h" Z, [ L. N& H( y
// Enter the path to a model file! 0 c' P; `0 E; ^+ T
simple.LoadModel("C:\\Models\\Test.spp"); ( ]1 i% n) _: ], J! o
} 2 P& _, e. `/ T
catch (e)
. Y3 |+ O9 N7 E2 }/ W' j h{
0 @: I: t, l& s$ o1 E/ l4 V WScript.Echo("Could not load Model!"); * B) H+ \5 W9 \2 _8 D3 b
WScript.Quit();
5 o5 J9 m7 w8 h- n( c} * p* X l7 t' H' o9 D* E
1 q3 W6 w- e2 k* ^& b% utry 3 g' l+ p& s, |" [7 z
{ 9 H% [' C" N- s% x% {
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 n) P/ O7 ]; L5 L; S2 {% K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " M" H# l5 O8 O% n
if (r == vbCancel)
: O; b S- W O0 G1 p2 O! E { ( Q3 b& S- u6 H$ l, ~9 g
simple.CloseModel(); # p' J0 P4 P9 I" r+ ?* f: b+ T
WScript.Quit();
; w3 Z. A' b. C9 _! X6 y0 m } 2 v8 w8 }9 g5 S3 M- k: }
}
# Z$ E5 F* K- }3 K5 K. x, u # p+ I1 Z( F& I; S) A
simple.StartSimulation(".Models.Frame.EventController");
3 T# K3 c. i4 U% r5 M4 B) W+ F
2 a' G9 W2 G2 T) H) o" _if (simple.IsSimulationRunning())
3 e, o" Q1 J; x" L8 q6 L' C& G0 n- x WScript.Echo("Simulation is running!");
2 S% p( a: D. K$ a* K, A& }9 Y h 0 w" P. L6 b- }! b$ J# T$ J- B% U
// Wait until simulation is finished
3 `9 w/ s. I4 e3 S' Iwhile (!Finished) WScript.Sleep(2000);
# _/ Y9 m) K) ~$ K 3 a+ w/ h6 H: e8 L' a M2 P# b
simple.CloseModel(); : A* j4 d) d+ Q# A6 Y
simple.Quit();
0 `7 l" P n: R1 c( q% R0 WWScript.Quit(); 7 p& u9 N) C* ]6 T: A
" W3 n) s, B6 g1 R
" h4 r1 h1 r" [; jfunction RemoteControl_SimulationFinished() ; F. k1 G' R9 R- S. h+ E
{
. o- o: ?* x; @' W( | WScript.Echo("Simulation Finished!"); |