WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Control Manager
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

cSetFocus Fails


Question:

I am trying to automate a window based Application.The functionality of this application is to convert file from one form to another.I used Roboscripter to do this. It works fine until the input file is loaded. After that it gives an error message saying that "Window cannot be detected" It fails after this command sometimes
cSetFocus(ControlHandle) ; Activates Window
Even if it runs fine,it does not perform its intended task(file conversion).PLease help me in solving this issue.

Answer:

If the script errors out on this function
cSetFocus(ControlHandle) ; Activates Window".
then that means the previous function could not find something and returned a 0

  1. All you might need to do is add a small TimeDelay. The windows may need just a little time to get fully populated, and when you record the script, there are the normal human-originated delays to pushing the buttons and stuff. It may be the script is running faster, and some of the windows are not quite ready to receive input yet or somethig. a TimeDelay(1) tossing in a statement or two ahead of where problems occur might fix everything.

  2. Try recording a Roboscript of that window. Then close the applicaton, start it ip again and record the same thing again.

    Hopefully the two recordings are idential. If not, then you may have to compensate for this somehow.

    In the RoboScripter OPTIONS dialog, you can enable "Verbose" mode, which will put alternate lines of code in your script as comments. So if you find that the recorded script varies, you can study the alternate codings and try to find a combination where it is identical for all recordings.

    Pay careful attention to the cWndByWndSpec statements. Those have to be identical.

-- People ask me why I play with computers at home when I use them at work. They don't understand--I play with computers at work, too
Article ID:   W16820
File Created: 2007:07:03:14:26:24
Last Updated: 2007:07:03:14:26:24