Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header files 1

Status
Not open for further replies.

samato

Technical User
Apr 26, 2003
37
US
I use many many macros and periodically I need to increase the HostSettleTime. This is difficult to do with over 60 macros. Can I incoprporate the host settle time into a header file and have each macro access the header file so I can change this time in one file only and have it affect every macro? I'll need specifics you are are going to make any suggestions. Right now I have this coded in my macro. Thank you in advance.

g_HostSettleTime = 200 ' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
 
 0
Yes, you can do this. Just use an include statement. For more info, see my post from here:
thread99-532191
It has some specifics about header files and how to use them.

I personally don't use settletimes as they don't work the way the documentation says they do. Settle time is supposed to wait X number of seconds AFTER the host is quiet, but actually just waits that many seconds.

I've found it's much more efficient and accurate to use WaitForString. This allows you to put in the code exactly when the macro should continue after a page change, or other action. I've always been able to find and predict a string showing up on a page to use this.

Sess0.Screen.WaitForString string,x,y

x and y are optional screen location. If the string is very distinct, you can leave these off and the macro will look for that string anywhere on the screen.

calculus
 
 0
I tried this but it won't compile. Does the header need anything special in it?
 
 0
The use is as follows:

'$Include Whatever.ebh

The "'" is very important in this. It should be the first line of code in your macro. The header file (ebh) should be in the same directory as well.

Try to copy your code so I can see it. It's likely a syntax error somewhere.


 
 0
The WaitForString tip is excellent, but not as easy to implement as I had hoped. My Attachmate sessions have unique page names on every screen, so coming up with unique text is not a problem. But, implementing this has proven more difficult than I thought, and less rewarding than I had hoped.

I plugged the statement into two or three macros and ran it half a dozen times, and the macro aborted each time. Not sure why. One possible answer is that while my names for each page are unique, their occurrence within the session is not unique. So, the macro continues to execute when it should be pausing for a page update.

Another possible answer is problems at the network, and macro execution is moving faster than page update. More likely, it is something I haven't considered.

I do know I had less problem when I plugged in the screen location. I will likely play with this some more, and see if I can get it to work. Thanks for the tip.
 
 0
Re the WaitForString method, how do you write it so that if it doesn't ever find that string it doesn't hang?
 
 0
The "WaitForString" function will time out after about 30-40 seconds (at least on systems I've used). At which point you can check to see if the query failed.

If there's a chance the WaitForString will fail, you should probably try some other code to find out if the action was successful or not.

calculus
 
 0
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top