Jump to content
Macro Express Forums

Window Focus Issue, I Think


rberq

Recommended Posts

I have a macro whose scope is global. It is activated by window title XXX. It simply loops, recording the current time, as long as window XXX is on top.

 

Variable Set String %T89% "0"

Repeat Until %T89% = "1"

[get current time and record in environment variable]

If Not Window Title "XXX" on top

Variable Set String %T89% "1"

End If

Delay 100 Milliseconds

Repeat End

//

Variable Save All Variables

//

Macro Stop

 

Window XXX contains a number of drop-down lists. When the user opens a list,

(1) the list becomes the on-top window as far as ME is concerned, and the macro recognizes that and exits

(2) the user selects from the drop-down list

(3) the list closes, making XXX the on-top window again, and the macro begins running again

(4) the application very quickly opens window YYY on top of XXX, based on the selection from the drop-down list, while the macro is still running

(5) FOR SOME UNKNOWN REASON, window XXX apparently regains focus, which is recognized by the application (not the macro), and the application closes window YYY (bad!)

 

If I increase “Delay 100 ms” to a longer delay, then everything works fine – window XXX does NOT regain focus after window YYY opens, so window YYY remains open. It is somewhere around “Delay 700 ms” that the problem disappears.

 

Yes, I know it makes no sense. Ideas, anyone?

Link to comment
Share on other sites

I have a macro whose scope is global. It is activated by window title XXX. It simply loops, recording the current time, as long as window XXX is on top.

 

Variable Set String %T89% "0"

Repeat Until %T89% = "1"

[get current time and record in environment variable]

If Not Window Title "XXX" on top

Variable Set String %T89% "1"

End If

Delay 100 Milliseconds

Repeat End

//

Variable Save All Variables

//

Macro Stop

 

Window XXX contains a number of drop-down lists. When the user opens a list,

(1) the list becomes the on-top window as far as ME is concerned, and the macro recognizes that and exits

(2) the user selects from the drop-down list

(3) the list closes, making XXX the on-top window again, and the macro begins running again

(4) the application very quickly opens window YYY on top of XXX, based on the selection from the drop-down list, while the macro is still running

(5) FOR SOME UNKNOWN REASON, window XXX apparently regains focus, which is recognized by the application (not the macro), and the application closes window YYY (bad!)

 

If I increase “Delay 100 ms” to a longer delay, then everything works fine – window XXX does NOT regain focus after window YYY opens, so window YYY remains open. It is somewhere around “Delay 700 ms” that the problem disappears.

 

Yes, I know it makes no sense. Ideas, anyone?

My first thought is that it has something to do with windows stealing focus from each other. Something within your operating system is trying to prevent one or the other window from stealing focus. Of course, when it comes to that stuff, I'm pretty much just spouting off my own interpretation of something I read somewhere once. This does not constitute legal advice. :P

Link to comment
Share on other sites

Something within your operating system is trying to prevent one or the other window from stealing focus

It is as if ME sees that the window title has focus, queues the macro to run, activates the window, and begins running the macro. Between the queuing and the activation, the window has lost focus, but ME gives it focus again, which screws up the application. I will submit a support question to ISS to see if I can get clarification.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...