3

I have an AHK script which saves window positions. At the moment I save Title, X, Y, Width, Height, Class, FullPath etc. I also want to save on which Virtual Desktop they are located on.

I dont know how Windows 10 handles Virtual Desktops: Do they have a UID? Do these UIDs change after a reboot? Is there any way to actually number them?

I would like to do it in a way which has a low chance of breaking in case of a Windows update, but obviously that's mostly a dream.

Thanks for any help!

  • [How can autohotkey detect which virtual desktop you're on?](https://stackoverflow.com/a/55855959/3419297). – user3419297 May 30 '20 at 22:37
  • can you create a script within your virtual desktop? or use share clipboard feature.. – DagicCross Jun 03 '20 at 10:58
  • Does this answer your question? [How can autohotkey detect which virtual desktop you're on?](https://stackoverflow.com/questions/47778700/how-can-autohotkey-detect-which-virtual-desktop-youre-on) – VFDan Jun 08 '20 at 23:40

1 Answers1

1

I've made an ahk function library,

to get the desktop (number) a window is on, use VD_getDesktopOfWindow(wintitle), where wintitle can be combination of WinTitle, ahk_class, ahk_exe, ahk_id, etc.

https://github.com/FuPeiJiang/VD.ahk

I've just made a script "list VD of all windows.ahk" in folder "other examples" to do what you need

It gets every window in every VD, and tells you, in order of VD, which windows are inside it.

Desktop 1: program.exe
Desktop 1: otherProgram.exe
Desktop 2: foobar.exe
Desktop 3: youGetThePoint.exe

the actual format is different

https://github.com/FuPeiJiang/VD.ahk/blob/master/other%20examples/list%20VD%20of%20all%20windows.ahk

Mr. Doge
  • 63
  • 1
  • 8
  • Absolutely brilliant, thank you I'll start working on my script again, I'll add your credits for this script of course and comply with AHK licensing guidelines – Szilvási Dávid Jan 07 '21 at 21:02
  • What does “the actual format is different” mean? What is the link that follows that statement? – randy May 13 '21 at 19:54