Manipulating Windows 10 sound adjustment popup

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 31 Jan 2023, 12:05

I'm trying to make a script which clicks on the Windows popup to close it. Thus far I have zero success: Spy and WinSpy both tell me this is Explorer.exe window but I have no luck finding it with WinGet no matter how I try. It's not even in the list of windows filtered by process name.

What's the problem?
Attachments
Annotation 2023-01-31 200257.png
Annotation 2023-01-31 200257.png (25.62 KiB) Viewed 722 times
Annotation 2023-01-31 200252.png
Annotation 2023-01-31 200252.png (29.25 KiB) Viewed 722 times

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Manipulating Windows 10 sound adjustment popup

Post by boiler » 31 Jan 2023, 12:23

We can't tell since you haven't shown us how you tried to implement it. This kind of issue is usually the result of incorrect syntax.

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 31 Jan 2023, 12:41

The boiler plate of my attempts:
Spoiler
But the actual problem is that there's no such window ID if I look into debugger:
изображение.png
изображение.png (238 KiB) Viewed 707 times

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Manipulating Windows 10 sound adjustment popup

Post by boiler » 31 Jan 2023, 12:51

Why does your RegEx pattern start with a backslash? Why are you using RegEx at all instead of just explorer.exe?

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 31 Jan 2023, 12:54

I was getting empty Window list and I thought that search was case sensitive. It does not matter, now I am getting same list without regex.
Spoiler

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 31 Jan 2023, 12:57

boiler wrote:
31 Jan 2023, 12:51
Why does your RegEx pattern start with a backslash? [/c]?
It's how it's written in the documentation.: https://www.autohotkey.com/docs/v1/misc/WinTitle.htm#ahk_exe

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Manipulating Windows 10 sound adjustment popup

Post by boiler » 31 Jan 2023, 13:05

Start with just a simple script like:

Code: Select all

MsgBox, % WinExist("ahk_exe explorer.exe")
...so you can prove to yourself that it finds the window, then build from there.

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 31 Jan 2023, 13:19

boiler wrote:
31 Jan 2023, 13:05
Start with just a simple script like:

Code: Select all

MsgBox, % WinExist("ahk_exe explorer.exe")
...so you can prove to yourself that it finds the window, then build from there.
Please refer to my last screenshot which literally displays all windows from explorer.exe. There is no problem with that.

The problem is: the handle which WinSpy shows is not present there and searching by needed ahk_class does not give anything either.

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Manipulating Windows 10 sound adjustment popup

Post by boiler » 31 Jan 2023, 14:50

How do you know that 0x808DE is one of the window IDs? Your WinSpy image is showing a different class than the one for an explorer window.

In any case, there is no reason to look for specific numbers since they change for each new instance. It's still not clear what you are trying to do.

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 31 Jan 2023, 14:57

boiler wrote:
31 Jan 2023, 14:50
How do you know that 0x808DE is one of the window IDs? Your WinSpy image is showing a different class than the one for an explorer window.

In any case, there is no reason to look for specific numbers since they change for each new instance. It's still not clear what you are trying to do.
That's one of the things I tried. Refer to my code to see what else I tried:
- coordinate search
- class search

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Manipulating Windows 10 sound adjustment popup

Post by boiler » 31 Jan 2023, 17:05

Do you realize that every time that window pops up, it is going to have a different ID? You can't find it by number unless you are searching for the same instance that already exists. That's why it's useless to use an exact numerical ID as the criterion. You only use window IDs when your script gets them dynamically so you can refer to the same window again (i.e., before it closes because it will have a different ID next time) when you need to. You never even know or care what the actual number is.

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 01 Feb 2023, 11:01

boiler wrote:
31 Jan 2023, 17:05
Do you realize that every time that window pops up, it is going to have a different ID?
Does this look like an ID to you?
изображение.png
изображение.png (215.05 KiB) Viewed 574 times

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Manipulating Windows 10 sound adjustment popup

Post by boiler » 01 Feb 2023, 13:45

This does:

Code: Select all

 		if(id=0x808DE){

So again I would ask if you are expecting that window to always have that ID, although I no longer care about the answer after your flippant response.

betonKruglosuTotchno
Posts: 8
Joined: 29 Jan 2023, 02:48

Re: Manipulating Windows 10 sound adjustment popup

Post by betonKruglosuTotchno » 06 Feb 2023, 08:19

boiler wrote:
01 Feb 2023, 13:45
This does:

Code: Select all

 		if(id=0x808DE){

So again I would ask if you are expecting that window to always have that ID, although I no longer care about the answer after your flippant response.
Why are you asking that since my code in no way makes that a requirement I have no idea. I said that I have tried a lot of criteria to find the window and my code shows what I tried. Of course I am not stupid.

If you do not believe this volume adjustment popup cannot be found through normal AHK calls, try it yourself. Even simpliest width+height search gives nothing.

Code: Select all

DetectHiddenWindows, On
SetTitleMatchMode, RegEx 

~Volume_Down::
~Volume_Up::
	Sleep, 1000
	ar := []
	WinGet windows, List, ahk_exe i)\\explorer\.exe$
	Loop %windows%
	{
		id := windows%A_index%
		WinGetPos X, Y, W, H, ahk_id %id%
		ar.Push([pn, id])
		if (W=509) and (H=140){
			MsgBox "Found"
		}		
	}

Post Reply

Return to “Ask for Help (v1)”