Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No session required on Windows 11 #90

Open
ethouris opened this issue May 25, 2023 · 0 comments
Open

No session required on Windows 11 #90

ethouris opened this issue May 25, 2023 · 0 comments

Comments

@ethouris
Copy link

I found this script here and it was kinda outdated on Windows 11. The location for the currently selected desktop is to be read by

		RegRead, CurrentDesktopId, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops, CurrentVirtualDesktop

I can see the version here is fixed, but this is kinda incorrect - the condition to check for SessionId only makes sense if you want to extract the key dependent on the SessionId - while the latest verison here reads the key with the path as above under this condition. Before looking here I fixed it myself this way (just to show you an example):

	IdLength := 32
	SessionId := getSessionId()
	if (SessionId) {
		RegRead, CurrentDesktopId, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\%SessionId%\VirtualDesktops, CurrentVirtualDesktop
		if (CurrentDesktopId) {
			IdLength := StrLen(CurrentDesktopId)
		}
	}
	if !CurrentDesktopId {
		RegRead, CurrentDesktopId, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops, CurrentVirtualDesktop
		if (CurrentDesktopId) {
			IdLength := StrLen(CurrentDesktopId)
		}
	}

(The problem with your version is that when there weren't SessionId, this script won't work, even though SessionId is not needed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant