SetFocus "problem"

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
nowind
Newbie
Posts: 10
Joined: Thu Jul 10, 2008 11:51 am

SetFocus "problem"

Post by nowind » Thu Jul 10, 2008 12:20 pm

I have created a macro and it works "almost" perfectly. It opens a new window, sets focus on this, choose a toolbar an clicks on the correct "button". Then I try to use Press Tab (3 times) to get to a box to write an IP address, but after the toolbar-button is clicked the window loses focus. Try SetFocus (all ways possible), but the focus will not "stay". When I do this manually everything is OK.
I have tried a lot of things, but nothing works (I do not have much experience with this program)...
Any suggestions on how to solve this?
[/img]

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Jul 10, 2008 3:14 pm

Try:
Let>WF_TYPE=2
SetFocus MyWindow

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Thu Jul 10, 2008 3:33 pm

I have an application that once it loses focus, I have to do a mouse click inside the window to regain focus. I could not get any combination of Setfocus> commands to work. :?: :?:

nowind
Newbie
Posts: 10
Joined: Thu Jul 10, 2008 11:51 am

Post by nowind » Thu Jul 10, 2008 4:09 pm

Thanks, but this doesn't work either. Mouse click inside did not help either, except when I do it manually.

Reason for setting IP is in case someone messes with it. Solved problem by restoring a backup of cfg-file before starting app. But it would be better to get this to work...

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Thu Jul 10, 2008 4:49 pm

Another frequent issue that I have experienced is timing. Sometimes the application just cant keep up with Macro Scheduler. Automatic delays between each step using the STEP_DELAY variable is one method. Hard coded delays with the Wait> command along with other commands like WaitwindowOpen> etc are sometimes essential. For example, in order to get to the right field on a particular web page, I needed to press tab 15 times. If I used the command "Press tab * 15" it would not always work correctly. My solution was to code a press tab loop with a STEP_DELAY variable.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts