...are likely/possibly numbered in the order they are detected - not necessarily in the order they appear in Settings or their physical order on your desk.
So, for example, it might seem natural to number your displays from top left to bottom right - just like reading a book.
This function GetDisplayByConvention()
maps a number to a screen based on the Convention described above.
It gets AllScreens
, orders them by Top
, then by Left
, skips the required number and returns the requested screen
e.g. on my laptop, which has this display setup
Calling the function for Display 1 GetDisplayByConvention(1)
returns Display3 because it is in the top,left position:
[Screen[Bounds={X=-1080,Y=0,Width=1080,Height=1920} WorkingArea={X=-1080,Y=0,Width=1080,Height=1920} Primary=False DeviceName=\\.\DISPLAY3]
Maybe this works for you - or maybe you have a different Convention?