Jump to content
Macro Express Forums

Block Windows Pop-ups?


rberq
 Share

Recommended Posts

We have several macros that retrieve data from one form and type it into another. While typing is taking place, Microsoft Outlook and Avaya Message Manager, among others, may pop up message boxes telling the user he has a new email or message. The pop-up gets focus and the macro keeps right on typing, but the text gets typed into the pop-up box or goes off to the Windows bit bucket.

 

Can anyone suggest a way to keep pop-up messages from stealing focus? (We can turn off the notification option in some applications, but some people would rather not.)

Link to comment
Share on other sites

1. Try sending text to a control.

 

2. Send text via the clipboard, which happens much faster than typing it out a character at a time.

 

3. Warn users that the macros may not be as reliable if they opt to have the notifications.

 

4. Script macros that are activated by notifications gaining focus. The macros close them. (You may need to use ME Pro for this, as several scripts can be running at the same time.)

Link to comment
Share on other sites

5. Surround your Text Type commands with something that sets focus back to the main application:

If Not Window Title "Your Application" on top
 Activate Window: "Your Application"
End If

This will only reduce, not eliminate, the risk.

 

6. Something like this might also work:

If Not Window Title "Your Application" on top
 // Get topmost window title
 Variable Set String %T9% from Window Title
 Wait Window Lose Focus: "%T9%"
 Activate Window: "Your Application"
End If
Text Type: Typing something here

Link to comment
Share on other sites

7. A brute force method: Place an extra line before each Text Type command:

 

  
Activate Window: "Your Application"
Text Type: Bla bla bla

 

8. If there are specific pop-ups that appear, test for them before each Text Type command:

 

  
If Window Title = "Pop Up 1"
OR
If Window Title = "Pop Up 2"
OR
If Window Title = "Pop Up 3"
  <code to close pop-ups>
End if
Text Type: Bla bla bla

Link to comment
Share on other sites

7. A brute force method: Place an extra line before each Text Type command:

Activate Window: "Your Application"
Text Type: Bla bla bla

This has performance penalties that are not necessary if the window already has focus. To optimize for both safety and speed use:

If Not Window Title "Your Application" on top
 Activate Window: "Your Application"
End If

(#5 above)

Link to comment
Share on other sites

Thank you everyone for the replies. I had done the negative of suggestion 5 -- that is, if the window was no longer in focus I was abandoning the typing on the theory that the user had intentionally canceled out of the window. I will try (5) or (6) and see if it flies. It will be vulnerable mainly during the duration of each individual Text Type command -- and I know there will be users who complain about that! It's amazing how 5 per cent of users account for 95 per cent of problems!

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...
 Share

×
×
  • Create New...