Windows 10 Start button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SomeNewb
Posts: 52
Joined: 08 Jan 2017, 18:43

Windows 10 Start button

26 Feb 2019, 01:13

I used the code below to do stuff with the Windows 7 start button when for example I right-click on it to open Classic shell.
But Windows 10 start button is different so I don't know how to fix this. Is it possible to correct this code for Windows 10?

Code: Select all

HoveringStart() {
    CoordMode, Mouse, Screen
    WinGetPos, Start_X, Start_Y, Start_W, Start_H, Start ahk_class Button
    WinGetPos, Tray_X, Tray_Y, Tray_W, Tray_H, ahk_class Shell_TrayWnd
    MouseGetPos, MX, MY
    return (MX <= Start_W) && (MY >= Tray_Y) ; true or false
}
#If
gregster
Posts: 9056
Joined: 30 Sep 2013, 06:48

Re: Windows 10 Start button

26 Feb 2019, 01:57

This should even work for people who don't have the taskbar at the bottom of the screen (like me).

Code: Select all

#If HoveringStart()
Rbutton::msgbox yes
#If

HoveringStart() {
    ; CoordMode, Mouse, Screen
    MouseGetPos, , , win, contr
	WinGetClass, class , % "ahk_id " win
	if (contr = "Start1") and (class = "Shell_TrayWnd")
    	return true 
}
SomeNewb
Posts: 52
Joined: 08 Jan 2017, 18:43

Re: Windows 10 Start button

26 Feb 2019, 02:45

It worked like a charm, great, thanks!
SomeNewb
Posts: 52
Joined: 08 Jan 2017, 18:43

Re: Windows 10 Start button

26 Feb 2019, 02:53

If I may bother you again. What is the code for the notifications icon on Win10 taskbar?

I use the code below for assigning for example the right click to something on the "show desktop button". But like the windows button this is new in Win10.

Code: Select all

#If (WinActive("ahk_exe Babylon.exe")) AND (MouseOver("TrayShowDesktopButtonWClass1"))
$LButton::
Send, !{F4}
Return
#If

MouseOver(Control) {
    MouseGetPos,,, Win, CurrentControl
    WinGetClass, Class, ahk_id %Win%
    Return ((Control = CurrentControl) and (Class = "Shell_TrayWnd")) ? 1 : 0
}
gregster
Posts: 9056
Joined: 30 Sep 2013, 06:48

Re: Windows 10 Start button

26 Feb 2019, 10:40

Sure, in this case it's TrayButton1.

Code: Select all

#If MouseOver("TrayButton1")	; AND (WinActive("ahk_exe Babylon.exe")) 
Rbutton::msgbox yes
#If

MouseOver(Control) {
    MouseGetPos,,, Win, CurrentControl
    WinGetClass, Class, ahk_id %Win%
    Return ((Control = CurrentControl) and (Class = "Shell_TrayWnd")) ? 1 : 0
}
You can use the WindowSpy.ahk script that was included with AutoHotkey to determine this information (in these cases, activate the 'Follow Mouse' check box at the top right).
SomeNewb
Posts: 52
Joined: 08 Jan 2017, 18:43

Re: Windows 10 Start button

26 Feb 2019, 10:59

Oh thanks, that's useful too indeed, one more button to have stuff on :D But I meant the notification button on the right side, next to the show desktop button. How does one get the names for those anyway, nothing shows up in windows spy.
gregster
Posts: 9056
Joined: 30 Sep 2013, 06:48

Re: Windows 10 Start button

26 Feb 2019, 11:13

Yeah, TrayButton1 is the name for the notification button.
TrayButton1.jpg
TrayButton1.jpg (7.3 KiB) Viewed 2383 times
How does one get the names for those anyway, nothing shows up in windows spy.
gregster wrote:activate the 'Follow Mouse' check box at the top right
There is a checkbox at the top right of the WindowSpy.ahk that you should activate in this case... perhaps it is missing in old versions. I use AHK v1.1.29.1
follow mouse.jpg
follow mouse.jpg (14.26 KiB) Viewed 2383 times
SomeNewb
Posts: 52
Joined: 08 Jan 2017, 18:43

Re: Windows 10 Start button

26 Feb 2019, 11:17

Oh, duh then, I wondered what that was..lol
Okay for me the tray button shows up as Traybutton2, Traybutton1 shows for the Task view button next to windows button. Maybe because I'm on a different version of windows 10 idk.

Anyway thanks a lot!
gregster
Posts: 9056
Joined: 30 Sep 2013, 06:48

Re: Windows 10 Start button

26 Feb 2019, 11:22

I see, I think I removed this Task view button somewhere in the options, when I started with Win10 (at least, it is gone now :D ). Perhaps Win10 then re-numbers the buttons... good to know.
Or, it's really because of a different version. (I might investigate at a later time...)
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Windows 10 Start button

28 Feb 2019, 10:07

gregster wrote:
26 Feb 2019, 11:22
I see, I think I removed this Task view button somewhere in the options, when I started with Win10 (at least, it is gone now :D ). Perhaps Win10 then re-numbers the buttons... good to know.
Or, it's really because of a different version. (I might investigate at a later time...)
With Win 10 1803, the Notifications icon can become TrayButton4 if other options are set... so, yes, Windows 10 does re-number them depending on how many are currently active.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Rohwedder, Scr1pter and 140 guests