Scroll through open windows issue when Task Manager or Services.msc windows active

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gregster
Posts: 9096
Joined: 30 Sep 2013, 06:48

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 15:38

What's the issue? Which code did you try?
(Hint: When you create a post, there is an edit field for your actual post and the detailed description of your problem. You could even add the code you have tried - between code tags, please. This will help your helpers to help you.)

But a guess: a permissions issue because Task Manager and other system windows run with elevated rights -> https://www.autohotkey.com/docs/v1/FAQ.htm#uac
kodarayan
Posts: 6
Joined: 17 May 2024, 15:05

Scroll through open windows issue when Task Manager, Services.msc or any other system console windows active

17 May 2024, 15:55

This is not my script, i copied and modified hotkeys for my use.It's working as intented but when I open Task Manager, it's scrolling only forward but not backwards. When I open Services.msc or any other system console windows, it stops working completely even minimized state.But If I minimize Task Manager, it works again.I'm not talking about opening Task Manager and Services.msc at the same time.I tried them individually.
Windows 10 22H2
Can anyone help me? Thanks in advance.

Code: Select all

~RButton & MButton::
   Send +{Click Right}  ; Shift+RightClick
return


~LButton & WheelUp:: ; Move bottom window to top
~LButton & WheelDown:: ; Move top window to bottom
win := []
WinGet, wins, List
Loop, %wins% {
 WinGetTitle, ttitle, % winTitle := "ahk_id " wins%A_Index%
 WinGet, proc, ProcessName, %winTitle%
 WinGet, state, MinMax, %winTitle%
 SplitPath, proc,,,, proc
 WinGetClass, class, %winTitle%
 If (ttitle > "" && (ttitle != "Program Manager" || proc != "Explorer") && class != "#32770" && state != -1)
  If proc not in Rainmeter
   win.Push(wins%A_Index%)
}
If (A_ThisHotkey = "~LButton & WheelDown") {
 WinSet, Bottom,  , % "ahk_id " win.1
 WinActivate      , % "ahk_id " win.2
} Else WinActivate, % "ahk_id " win[win.Count()]
Return
Last edited by gregster on 17 May 2024, 16:04, edited 1 time in total.
Reason: Merged duplicate topics.
gregster
Posts: 9096
Joined: 30 Sep 2013, 06:48

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 16:15

gregster wrote:
17 May 2024, 15:38
But a guess: a permissions issue because Task Manager and other system windows run with elevated rights -> https://www.autohotkey.com/docs/v1/FAQ.htm#uac
Your script needs elevated rights when an elevated window is active. If you follow the link above, you'll find a few options.
kodarayan
Posts: 6
Joined: 17 May 2024, 15:05

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 16:21

gregster wrote:
17 May 2024, 16:15
gregster wrote:
17 May 2024, 15:38
But a guess: a permissions issue because Task Manager and other system windows run with elevated rights -> https://www.autohotkey.com/docs/v1/FAQ.htm#uac
Your script needs elevated rights when an elevated window is active. If you follow the link above, you'll find a few options.
Thank you for your answer.
I checked if script and autohotkey was running in elevated state.Even if it is elevated, same problem occures.
gregster
Posts: 9096
Joined: 30 Sep 2013, 06:48

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 16:27

Can't reproduce it (on WIn11). With admin rights, the script works as expected, afaics - even with elevated windows.
Perhaps you need to describe in more detail what you do, what happens and what you want to happen instead.
kodarayan
Posts: 6
Joined: 17 May 2024, 15:05

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 16:38

I have intalled autohotkey v2 on top of v1.
In autohotkey folder, there are two version intances of v1 and v2.
v1.1.36.02, v2 and v2.0.2 AutoHotkeyUX version 2.0.11.0
I wonder if it is related.
gregster
Posts: 9096
Joined: 30 Sep 2013, 06:48

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 16:43

Don't think so, v1 and v2 can live happily together. Your script is v1 - it wouldn't run on v2 and v2 isn't involved in executing it. I have both installed (latest versions v1.1.37.02 and v2.0.15).
Just to be sure, what does this msgbox say, if you add it to the top of the script?

Code: Select all

msgbox % A_IsAdmin
kodarayan
Posts: 6
Joined: 17 May 2024, 15:05

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 16:49

msgbox says 1

FYI; This script works on my system in any condition without problem, even if it is not elevated.

Code: Select all

~RButton & WheelDown::Windows(-1) ; Switching between windows of the same application
~RButton & WheelUp::Windows(+1) ; Switching between windows of the same application

Windows(Direction)
{
	static total, hWnds, last := ""

	a := WinExist("A")
	WinGetClass wClass
	WinGet exe, ProcessName
	if (exe != last) {
		last := exe
		hWnds := []
		DetectHiddenWindows Off
		WinGet wList, List, % "ahk_exe" exe " ahk_class" wClass
		loop % wList {
			hWnd := wList%A_Index%
			hWnds.Push(hWnd)
		}
		total := hWnds.Count()
	}
	for i,hWnd in hWnds {
		if (a = hWnd)
			break
	}
	i += Direction
	; i := Max(1, Min(total, i))
	i := i > total ? 1 : i = 0 ? total : i
	WinActivate % "ahk_id" hWnds[i]
}
kodarayan
Posts: 6
Joined: 17 May 2024, 15:05

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 17:05

Maybe it is a specific problem only for my system.I don't know.
User avatar
Chunjee
Posts: 1479
Joined: 18 Apr 2014, 19:05
Contact:

Re: Scroll through open windows issue when Task Manager or Services.msc windows active

17 May 2024, 17:28

If I remember correctly the task manager runs at a different permission level. You might try running your script as administrator as a quick test

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: GoneFishing, Google [Bot], just_abs, mikeyww, Pianist and 179 guests