Start menu, Recent Items menu, focus first/last item Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 6655
Joined: 19 Dec 2016, 01:58
Location: UK

Start menu, Recent Items menu, focus first/last item

31 Jan 2017, 07:17

I have some code that uses the Acc library to focus the first/last item
in the Recent Items menu (Windows 7).
The question is if the focusing can be done directly via Acc.
The other question is, I am using MouseMove to hover over the menu item,
is it possible, to send a message that would mimic hovering over an item,
without actually moving the cursor there.
Cheers.

Code: Select all

#IfWinActive, Start menu ahk_class DV2ControlHost
Home:: ;start menu (recent items menu) - focus menu item
End:: ;start menu (recent items menu) - focus menu item
if !(hWnd := WinExist("ahk_class BaseBar"))
Return

ControlGet, hCtl, Hwnd, , ToolbarWindow321, ahk_id %hWnd%
oAcc := Acc_ObjectFromWindow(hCtl)

if A_ThisHotkey contains Home
oAcc := Acc_Child(oAcc, 1)
if A_ThisHotkey contains End
oAcc := Acc_Child(oAcc, oAcc.accChildCount)

oRect := Acc_Location(oAcc, A_Index)
vPosX := Round(oRect.x + oRect.w-15)
vPosY := Round(oRect.y + oRect.h/2)
MouseMove, %vPosX%, %vPosY%
Return
#IfWinActive
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6655
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Start menu, Recent Items menu, focus first/last item  Topic is solved

18 Feb 2017, 09:10

This script uses WM_MOUSEMOVE rather than Acc:
So I didn't *Acc*tually need Acc.

Code: Select all

#IfWinActive, Start menu ahk_class DV2ControlHost
Home:: ;start menu (recent items menu) - focus menu item
End:: ;start menu (recent items menu) - focus menu item
Numpad7:: ;start menu (recent items menu) - focus menu item
Numpad1:: ;start menu (recent items menu) - focus menu item
NumpadHome:: ;start menu (recent items menu) - focus menu item
NumpadEnd:: ;start menu (recent items menu) - focus menu item
if !(hWnd := WinExist("ahk_class BaseBar"))
	Return

if A_ThisHotkey contains Home,7
	PostMessage, 0x200, 0, % 10|(10<<16), ToolbarWindow321, ahk_id %hWnd% ;WM_MOUSEMOVE

if A_ThisHotkey contains End,1
{
	WinGetPos, , , , vPosH, ahk_id %hWnd%
	PostMessage, 0x200, 0, % 10|((vPosH-10)<<16), ToolbarWindow321, ahk_id %hWnd% ;WM_MOUSEMOVE
}
Return
#IfWinActive
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Godvicien, Google [Bot], Milenko and 163 guests