Andrew S Posted November 13, 2006 Share Posted November 13, 2006 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 Link to comment Share on other sites More sharing options...
ChrisL Posted November 13, 2006 Share Posted November 13, 2006 (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 doEdit... Actually this is better ControlClick ("Adobe Reader","Adobe Reader could not open","OK")The other method made acrobat hang Edited November 13, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Bert Posted November 13, 2006 Share Posted November 13, 2006 From AutoIt window info tool:>>>>>>>>>>>> Window Details <<<<<<<<<<<<<Title: Adobe AcrobatClass: #32770Size: X: 1305 Y: 306 W: 462 H: 205>>>>>>>>>>> Mouse Details <<<<<<<<<<<Client: X: 222 Y: -10Cursor 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. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Andrew S Posted November 21, 2006 Author Share Posted November 21, 2006 (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 November 21, 2006 by Andrew S Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now