Example of a JScript
7 v1 o6 S( \3 Y: q( V, R Dvar vbOKCancel = 1; 3 I0 o6 w# R5 f" `1 }1 Z3 q8 k3 n
var vbCancel = 2;
) p. o; l' L7 q1 D4 r' avar vbInformation = 64;
/ ^; C% R' r5 Q: A( _, h, Rvar Finished=false; 9 L/ U! g: E* h9 {! q
3 R& u" s7 _6 `5 l" q2 Z
var WSHShell = new ActiveXObject("WScript.Shell");
~- V/ n0 B0 Y ' r* ?; Y G8 @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 I4 w. G0 `0 }7 h 3 @/ B% S6 j$ L& T8 f% `: I
simple.SetLicenseType("Runtime");
* B2 U% K6 p+ ^3 w* |" j
+ ]0 [; M; a! a" g% E- Ttry 3 J! i7 c- Y% c9 j4 w G
{
* B# X. {; ^! a$ I/ {2 ` // Enter the path to a model file!
, d# \- x8 j1 f3 R" ]5 t% o simple.LoadModel("C:\\Models\\Test.spp"); 8 ]8 \, W+ H q" m1 K# h, L6 _! b
}
. I$ n8 }: k& S4 g8 D5 `catch (e) : ]$ N; ~2 [# n B7 C/ M
{ S& e% O* v1 W
WScript.Echo("Could not load Model!");
2 R% }! x0 n% I9 o) G WScript.Quit();
3 v$ x0 u4 d( t b+ i} 2 U5 e1 i3 E% R7 E7 O$ z8 s
! G+ U$ }! p2 a d3 V+ p) d0 @try 5 I: ~ d E5 ~! p0 y1 j r
{ , |7 B& ^1 |; i+ V5 F. ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( K) P: V* w; P9 L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( `' V6 r+ S, g) M V8 Z if (r == vbCancel) 9 ~# U: z* m5 X% b* ]
{ % A! n# p! \3 X/ J7 x O8 @
simple.CloseModel();
8 q) d9 s v B3 \ WScript.Quit(); 2 R6 N' p N0 K
} - b* u. R) f$ q. R; b: E: W/ x
} 0 x$ X* u, `- W- d. t
, V# x, K7 s3 ]simple.StartSimulation(".Models.Frame.EventController"); $ E5 G. b" m+ c& b& `
. o. D0 j9 W1 P0 \/ @+ [3 I
if (simple.IsSimulationRunning())
$ o; a \9 I3 f- [/ } I& O WScript.Echo("Simulation is running!"); # ^) B- G# i1 ^& b9 X0 o5 c4 a
) H' O5 B' {' Q
// Wait until simulation is finished
+ i6 T* _! ]% U6 wwhile (!Finished) WScript.Sleep(2000); % \! b! n& D6 ?% c0 e; i
' r5 F p. Y5 W! A8 F( S0 ?
simple.CloseModel(); 6 ?! O+ R) q9 \/ W% H
simple.Quit(); ) @$ D- Z i4 A0 r1 v8 t& S
WScript.Quit(); - t# k* I x/ L% O2 h
2 H' m, ^/ K* _) H3 g: G) M. {6 i" P
7 `0 C" s. E* `- o. {function RemoteControl_SimulationFinished() . d+ z) v0 k- L+ E+ h
{
- n/ t! W6 @/ ` T; _ g WScript.Echo("Simulation Finished!"); |