Sign in to follow this  
Followers 0
Andrew S

Dealing with message boxes

4 posts in this topic

Hi, I am looking for a way to deal with message boxes that may pop up in an application. The issue in question is detecting bad files with Adobe Acrobat--Acrobat pops up a message box when this happens. (Reader or Professional)

My current solution is as follows:

1. (with all Adobe Acrobat windows closed) open a PDF file with Acrobat (Run X.pdf in AutoIt)

2. Wait 1 second

3. send alt-f4. This closes any error box.

4. if the Adobe Acrobat window still exists, log this file in an error file and send alt-f4 again

This does an end run around my ignorance of Message Boxes, and it seems to work pretty well, but it is time consuming and makes for awkward code. Obviously if I could just open and close files as needed, checking for message boxes, I could save the overhead of opening/closing Adobe Acrobat.

I didn't find anywhere in the documentation or FAQs or by googling to deal with them. Does anyone have any advice, even if it is just to detect when the main window is not active and there is a popup?

You can reproduce the problem by changing a text file's extension to PDF and opening it, or even, from DOS,

echo random text>xyz.pdf

xyz.pdf

Thanks in advance!

Andrew

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well doing what you said with a dummy file, this closes the window.

WinClose ("Adobe Reader","Adobe Reader could not open")

I'm not really sure what else your trying to do

Edit... Actually this is better ControlClick ("Adobe Reader","Adobe Reader could not open","OK")

The other method made acrobat hang

Edited by ChrisL

Share this post


Link to post
Share on other sites

From AutoIt window info tool:

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Adobe Acrobat

Class: #32770

Size: X: 1305 Y: 306 W: 462 H: 205

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Client: X: 222 Y: -10

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x5574AB Dec: 5600427

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size:

Control ID:

ClassNameNN:

Text:

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

Acrobat could not open 'log1.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF.

OK

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

Make a loop that looks for this window, and have it closed when it shows up. Then have Adobe close if you like.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ouch, forgot I logged into these forums and asked this question. Belated thanks to both of you! I hadn't tried any of this before. I tend to get stuck trying the same old functions without learning new ones.

Edited by Andrew S

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0