Jump to content

Unable to handle IE SaveAs Notification bar


Recommended Posts

WinActivate("[A] Item Details - Internet Explorer")
WinWaitActive("[A] Item Details - Internet Explorer")

;Option 1: focus on notification bar
;ControlFocus("[A] Item Details - Internet Explorer","","DirectUIHWND1")
; or
;Option 2: Send alt+n key to focus on navigation bar
Send("!N")

;Send DOWN key to navigate to Save as option
Send("{DOWN}")

;Send A to open 'Save as' dialog box
Send("{a}")

;Wait for dialog window to open
WinWait("Save As")
$hWnd = WinGetHandle("Save As")

Sleep(2000)

;Set focus on 'Save as' dialog box
ControlFocus($hWnd, "", "[CLASS:Edit; INSTANCE:1]")
;Set text to TEST_FILE.html
ControlSetText($hWnd, "", "[CLASS:Edit; INSTANCE:1]", "Test_File", 1)


;Sleep for 4s
Sleep(4000)

ControlFocus($hWnd, "", "[CLASS:ToolbarWindow32; INSTANCE:3]")
; Right click inside control to invoke "Edit Address"
ControlClick($hWnd, "", "[CLASS:ToolbarWindow32; INSTANCE:3]", "right")
; Choose "Edit Address" option
ControlSend($hWnd, "", "[CLASS:ToolbarWindow32; INSTANCE:3]", "e")
Sleep(250)

Send("{DEL}")
Sleep(250)

Send("autoIt\au3_files\IE" & "{ENTER}")
Sleep(250)

ControlClick($hWnd, "", "[CLASS:Button; TEXT:&Save;]")

WinClose($hWnd)

Link to comment
Share on other sites

Please use this tool when you post code.

Here what I am using :

Const $sFileName = "C:\Apps\Temp\Test.txt" ; full path
FileDelete($sFileName)
Local $hWnd= _IEPropertyGet ($oIE, "hwnd")
Local $hCtrl = ControlGetHandle ($hWnd, "", "DirectUIHWND1")
ConsoleWrite ("Control = " & $hCtrl & @CRLF)
If Not $hCtrl Then Exit MsgBox ($MB_SYSTEMMODAL, "", "Unable to find DL control")
WinActivate ($hWnd)
WinWaitActive($hWnd)
ControlSend ($hWnd, "", $hCtrl, "{F6}{TAB}")
Sleep (800)
ControlSend ($hWnd, "", $hCtrl, "{DOWN 2}{ENTER}")
$hDlg = WinWait("Enregistrer sous")
ConsoleWrite ($hDlg & @CRLF)
Sleep(1000)
$hFile = ControlGetHandle($hDlg, "", "Edit1")
ConsoleWrite ($hFile & @CRLF)
ControlSetText($hDlg, "", $hFile, $sFileName)
ControlClick($hDlg, "", "Button1")

; wait till the DL is finished
Do
  Sleep(100)
Until FileGetSize($sFileName)
Sleep (1000)

; to hide the download window
WinActivate($hWnd)
ControlSend($hWnd, "", $hCtrl, "{F6}")
Sleep(300)
ControlSend($hWnd, "", $hCtrl, "{ESC}")
Sleep(1000)
;_IEQuit ($oIE)

You will need to change title of the Save As Dialog Window...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...