Example of a JScript
' X5 R3 h* c1 ~; F- d3 tvar vbOKCancel = 1;
0 K/ }* j8 M" O( @% \7 @# n8 Ovar vbCancel = 2; / i2 f% l p% U0 G$ @8 Q* r
var vbInformation = 64;
1 V( s+ v9 @/ `% {* ivar Finished=false;
|. Q7 U; I7 O1 l: }! t$ s0 B " R. Q* O: o/ t6 E0 ~
var WSHShell = new ActiveXObject("WScript.Shell"); & m0 p. x2 L( f$ w- c+ {
+ L* ]( B3 E" F2 k& F; o+ |' fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. }" N& N! ?( {3 Q: @ , y# d& c$ F4 C/ u
simple.SetLicenseType("Runtime");
1 ^1 s+ W: h- Y8 @: p( b3 C, R ; B+ _* G; Y7 B1 J) n
try " o1 ~ w! w# b8 s4 t. p7 [0 u
{ * w9 o5 n j/ Q$ g0 j
// Enter the path to a model file!
) d0 L8 d! f X simple.LoadModel("C:\\Models\\Test.spp"); * _5 V* p) p3 _" E* h
}
; K& X' H$ H s' B" H Q. b5 g3 K4 h1 icatch (e)
3 X1 H, V5 f% n7 T{
# L6 S$ W; X+ J$ P9 P8 M WScript.Echo("Could not load Model!");
% G# I \0 ^9 Q- I. f1 F WScript.Quit();
% r% ]) B' l; ~* A* [8 j4 j* T# s}
- ]3 R1 `/ H+ K$ ~$ V4 B: |4 J+ u1 P7 ^0 C
6 {. V2 e% e+ {' g2 G" g) }$ Utry 4 S8 J" j2 V$ _% B& X# i
{
( D0 s4 ^- { v( G- w! f: q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( `8 @6 J: ]# W# ]! H4 a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 l- t! y2 y6 r: q* E! n if (r == vbCancel)
' c0 w0 E; {4 q9 w# k4 B {
& ?% E' l1 v8 E) ` simple.CloseModel(); ) q# F5 W1 ~; |, `# l& d x8 \
WScript.Quit();
1 Z# D5 K# F9 R: D$ V- q }
/ w+ U$ x/ L; }: f, K} % W9 g5 t( |; q6 H( e2 c& b
% W" U; L; x- |0 d+ Usimple.StartSimulation(".Models.Frame.EventController"); 2 M, P% q1 a6 t. S i( Z
: V, \. N; a* G- U& ]/ z/ M! p& }/ J
if (simple.IsSimulationRunning())
- n7 O$ S) ^* T$ E+ Y3 n" ?, y WScript.Echo("Simulation is running!"); 2 v9 b( y" ]7 [6 x
9 e0 d' W) D8 G) r! A// Wait until simulation is finished
% ^, w$ }$ s! |0 I6 gwhile (!Finished) WScript.Sleep(2000); ! x: d8 ?6 ^& q1 b
8 T! r* \2 K) O/ o- E& d/ }1 x
simple.CloseModel(); ! ~' {& g$ ~6 y, x" P4 [! ^, Z
simple.Quit();
; T a% w( a i6 U$ WWScript.Quit(); " z, G6 w; c4 o% V* q% g5 e; z
& @, b+ c2 Q# L
, ~, z# J1 W$ Ofunction RemoteControl_SimulationFinished() " ~6 P. |( B' V
{ 2 d- p2 R U% X! G
WScript.Echo("Simulation Finished!"); |