Gaurang Posted July 9, 2009 Share Posted July 9, 2009 Hi Folks, I am newbie to Autoit. I am doing some automation with selenium, But selenium can't handle the native dialog box. so for that i use the AutouIt script. I am trying to handle the Save Dialog box of firefox. But seems like AutoIT is not able to identify the buttons on it. My basic need is to download a file using AutoIT script in Firefox browser on Windows plaform. And for that i am using following script AutoItSetOption("WinTitleMatchMode","2") ; set the select mode to select using substring ; wait Until dialog box appears WinWait($CmdLine[1]) ; match the window with substring $title = WinGetTitle($CmdLine[1]) ; retrives whole window title MsgBox(0,"",$title) WinActivate($title) MsgBox(0,"",ControlGetText($title,"","Button1")) // Returns 0 MsgBox(0,"",ControlGetText($title,"","Button2")) // Returns 0 MsgBox(0,"",ControlGetText($title,"","Button3")) // Returns 0 MsgBox(0,"",ControlGetText($title,"","Button4")) // Returns 0 MsgBox(0,"",ControlGetText($title,"","Button5")) // Returns 0 As i not getting the text through ControlID I use it's name. But no Luck. ControlClick($title,"","Save File") can anybody tell me why so happening.. Link to comment Share on other sites More sharing options...
dantay9 Posted July 10, 2009 Share Posted July 10, 2009 Welcome to the forum!You can use FF.au3 for just about anything in Firefox. All thanks to Stilgar! Link to comment Share on other sites More sharing options...
KaFu Posted July 11, 2009 Share Posted July 11, 2009 (edited) I use this function in FFAddOn to detect standard FF "Save As" Dialogs... check the download Window with AU3Info and adjust the function respectively. Then you've got a handle to the window and you can use controlclick (also check ids with AU3Info). Edit #1: Tested, readjusted and added example, should detect download dialog now... Edit #2: Rethought the concept, _Detect_FF_dialog_hWnd() is only useful to detect standard Win dialog associated with FF, the MozillaDialogClass can better be detected with a simple winexist() function. #include<WinAPI.au3> #include<WindowsConstants.au3> While Sleep(10) If IsHWnd(_Detect_FF_dialog_hWnd()) Then MsgBox(0, "", "FF File Dialog detected...") If WinExists("[CLASS:MozillaDialogClass;]", "") Then MsgBox(0, "", "FF MozillaDialogClass detected...") WEnd Func _Detect_FF_dialog_hWnd() Local $hWnds $hWnds = WinList("[CLASS:#32770;]", "") For $i = 1 To $hWnds[0][0] If BitAND(WinGetState($hWnds[$i][1], ''), 2) Then $hwnd_PID = WinGetProcess(_WinAPI_GetAncestor($hWnds[$i][1], $GA_ROOTOWNER)) $processlist = ProcessList("firefox.exe") For $y = 1 To $processlist[0][0] If $processlist[$y][1] = $hwnd_PID Then Return $hWnds[$i][1] EndIf Next EndIf Next Return 0 EndFunc ;==>_Detect_FF_dialog_hWnd Edited July 11, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Stilgar Posted July 13, 2009 Share Posted July 13, 2009 You can better do this this with the FF.au3 and the _FF_DM.au3. You can handle with them the FireFox-download-manager.To wait for a window with the "MozillaDialogClass" is useless. This could be any FireFox-window which isn't a browser-window. jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Azhar Posted July 23, 2012 Share Posted July 23, 2012 Hi All, Can any one please tell me the script to handle this Firefox Save Window Thanks Azhar 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