Internet Explorer Download Notification handling using ACC

Post your working scripts, libraries and tools for AHK v1.1 and older
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Internet Explorer Download Notification handling using ACC

28 Sep 2018, 13:15

It basically allows interacting with the yellow IE Download Notification using Acc, it's a more reliable alternative to using Send... I use a lot of snippets from Jeeswg,given his tutorials are awesome so shout/OUT.

Cheers.

Code: Select all

DetectHiddenWindows, on

z::MsgBox % IE_IsDownloadNotificationActive()
x::IE_DownloadNotificationCancel()
a::IE_DownloadNotificationSaveAs()
s::IE_DownloadNotificationSave()
d::IE_DownloadNotificationOpen()

IE_DownloadNotificationSave(){
	If !SubStr(IE_IsDownloadNotificationActive(),1,1)	;the first substr as the function returns more than one line...6
		Return
	;to test whether it's visible and retrieve its name (it should be 'Notification')
	WinGet, hWnd, ID, A
	ControlGet, hCtl, Hwnd,, DirectUIHWND1, % "ahk_id " hWnd
	ControlGet, vIsVisible, Visible,, DirectUIHWND1, % "ahk_id " hWnd
	oAcc := Acc_ObjectFromWindow(hCtl)
	oAccNotif := Acc_Get("Object", "4.1", 0, "ahk_id " hCtl)
	;to close the notification bar
	oAcc := Acc_Get("Object", "4.3", 0, "ahk_id " hCtl)
	oAcc.accDoDefaultAction(0)
	Return
}

IE_DownloadNotificationSaveAs(){
	If !SubStr(IE_IsDownloadNotificationActive(),1,1)	;the first substr as the function returns more than one line...
		Return
	;internet explorer - notification bar interactions (click 'Save as')
	;to test whether it's visible and retrieve its name (it should be 'Notification')
	WinGet, hWnd, ID, A
	ControlGet, hCtl, Hwnd,, DirectUIHWND1, % "ahk_id " hWnd
	ControlGet, vIsVisible, Visible,, DirectUIHWND1, % "ahk_id " hWnd
	oAcc := Acc_ObjectFromWindow(hCtl)
	oAccNotif := Acc_Get("Object", "4.1", 0, "ahk_id " hCtl)

	;to click the down arrow
	oAcc := Acc_Get("Object", "4.3.1", 0, "ahk_id " hCtl)
	oAcc.accDoDefaultAction(0)
	
	WinWait, ahk_class #32768
	PostMessage, 0x102, % Ord("a"), 1,, % ahk_class #32768 ;WM_CHAR ;worked
}


IE_DownloadNotificationOpen(){
	If !SubStr(IE_IsDownloadNotificationActive(),1,1)	;the first substr as the function returns more than one line...
		Return
	;to test whether it's visible and retrieve its name (it should be 'Notification')
	WinGet, hWnd, ID, A
	ControlGet, hCtl, Hwnd,, DirectUIHWND1, % "ahk_id " hWnd
	ControlGet, vIsVisible, Visible,, DirectUIHWND1, % "ahk_id " hWnd
	oAcc := Acc_ObjectFromWindow(hCtl)
	oAccNotif := Acc_Get("Object", "4.1", 0, "ahk_id " hCtl)

	;to close the notification bar
	oAcc := Acc_Get("Object", "4.2", 0, "ahk_id " hCtl)
	oAcc.accDoDefaultAction(0)
	Return
}

IE_DownloadNotificationCancel(){
	If !SubStr(IE_IsDownloadNotificationActive(),1,1)	;the first substr as the function returns more than one line...
		Return
	;to test whether it's visible and retrieve its name (it should be 'Notification')
	WinGet, hWnd, ID, A
	ControlGet, hCtl, Hwnd,, DirectUIHWND1, % "ahk_id " hWnd
	ControlGet, vIsVisible, Visible,, DirectUIHWND1, % "ahk_id " hWnd
	oAcc := Acc_ObjectFromWindow(hCtl)
	oAccNotif := Acc_Get("Object", "4.1", 0, "ahk_id " hCtl)

	oAcc := Acc_Get("Object", "4.5", 0, "ahk_id " hCtl)
	oAcc.accDoDefaultAction(0)
	Return
}


IE_IsDownloadNotificationActive(){
	ControlGet, vIsVisible, Visible, , DirectUIHWND1, A
	ControlGet, hCtl, Hwnd, , DirectUIHWND1, A
	oAcc := Acc_ObjectFromWindow(hCtl)
	oAccNotif := Acc_Get("Object", "4.1", 0, "ahk_id " hCtl)

	Try
		Return % vIsVisible "`n" oAcc.accName(0) "`n" oAccNotif.accName(0) "`n" oAccNotif.accValue(0)
	
}

live ? long & prosper : regards

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: shiori4 and 150 guests