FuPeiJiang / VD.ahk

Windows Virtual Desktop, AutoHotkey, Windows 11 support, Windows Server 2022, switch desktop, move window(wintitle) to current desktop; createDesktop, PinWindow, getCount, getDesktopNumOfWindow -> mute all windows in Virtual Desktop
MIT License
319 stars 45 forks source link

Switching to Relative Desktop fails initially #59

Open daveM246 opened 9 months ago

daveM246 commented 9 months ago

I'm running the v2_port version with a modified VD.ah2 so that it works under windows 11 build 22621. The VD.ah2 is attached When I run the MoveToDesktop.ahk (attached) the ^#left and ^#right do not switch to the relative desktop. The code runs but the desktop doesn't change. If I run #!right everything comes right: I can then use ^#left and ^#right as expected, until the next time that I load the AHK script (next logon). If I uncomment the MsgBox line (line 41 in MoveToDesktop.ahk) then everything works (after acknowledging the MsgBox). Similarly if I put a MsgBox in the ^#left and ^#right section they will also work but that puts up a MsgBox every time the key combo is used !

Files.zip

daveM246 commented 9 months ago

Actually, after a computer restart with the compiled exe loading from startup, the MsgBox doesn't help. I need to do a #!right (or left) before the ^#left or ^#right will move to the relative desktop. I'm getting the exact same issue on a windows10 computer with the same MoveToDesktop compiled using V2.0.2 AutoHotKey64.exe attached is all of the files used. AHKMoveToDesktop.zip

daveM246 commented 9 months ago

I did some more testing. Cloned the v2_port branch again, added in my extras (Icon folder and MoveToDesktop.ahk) and replaced VD.ah2 with the modified version to work on latest windows 11. Ran the ahk and it worked perfectly. Made an exe and it worked perfectly, even after Exit and reloading. Rebooted the computer and back to same issue of the goToRelativeDesktopNum not working until after a #!left (or right) was used. Seems something is changing from one windows session to another and is not being initialized initially . Found that it I use ^#, and ^#. instead of ^#left and ^#right it works correctly even after making an exe and rebooting. This is also weird as I had tested by putting a MsgBox in the code for those key combos and the MsgBox would show up but the desktop would not change which meant that the key combo was being actioned by AHK.