Identify monitor numbers with IDMonitors()

Post your working scripts, libraries and tools for AHK v1.1 and older
Bkid
Posts: 31
Joined: 13 Jun 2014, 12:19

Identify monitor numbers with IDMonitors()

Post by Bkid » 17 Jun 2014, 20:21

Just something I threw together, and I'm sure could be improved upon.
When called, it counts the number of monitors and displays their appropriate number on each monitor.
It looks good so far on 2 monitors, but I don't have a way to try it on more at the moment.

Currently, the display time (time it stays up for), text color, and text size can be changed when called.

Just #Include IDMonitors.ahk and you're good to go!

Code: Select all

;Usage is IDMonitors().
;The display time can be set (in milliseconds).
;The Text color can be set in RGB format.
;The Text Size can also be set.
IDMonitors(disptime=1500,txtcolor="000000",txtsize=300)
{
SysGet, MonNum, MonitorCount
TPColor = AABBCC
GuiNum = 50
Loop %MonNum%
{
	SysGet, Mon%A_Index%, Monitor, %A_Index%
	x := Mon%A_Index%Left
	Gui, %GuiNum%:+LastFound +AlwaysOnTop -Caption +ToolWindow
	Gui, %GuiNum%:Color, %TPColor%
	WinSet, TransColor, %TPColor%
	Gui, %GuiNum%:Font, s%txtsize% w700
	Gui, %GuiNum%:Add, Text, x0 y0 c%txtcolor%, %A_Index%
	Gui, %GuiNum%:Show, x%x% y0 NoActivate
	GuiNum++
}
Sleep, %disptime%
GuiNum = 50
Loop %MonNum%
{
	Gui, %GuiNum%:Destroy
	GuiNum++
}
}

Comments and improvements on the code definitely welcome. :)

DMDComposer
Posts: 12
Joined: 14 Jul 2018, 18:55
Contact:

Re: Identify monitor numbers with IDMonitors()

Post by DMDComposer » 16 May 2021, 07:59

Hey Bkid!

Nice script! I just wanted to let you know because I have 6 monitors, 3 on bottom LCR & 3 on top LCR and the script overlaps the top monitors ontop of the bottom monitors. Just wanted to let you know since you said you didn't have more monitors to test. I realize you may have posted this a bit ago but just came across it and found it to be pretty neat.

Cheers!
image.png
image.png (16.32 KiB) Viewed 1173 times

pippo32
Posts: 1
Joined: 21 Dec 2016, 05:22

Re: Identify monitor numbers with IDMonitors()

Post by pippo32 » 04 Feb 2023, 05:18

Sorry, I'm a beginner. How do I run the script???
I don't know if it's for me. With hotkeys (for example with CTRL+ALT+\) I would like to open the resource manager on the monitor I'm currently working on, not on the primary monitor.

User avatar
lmstearn
Posts: 681
Joined: 11 Aug 2016, 02:32
Contact:

Re: Identify monitor numbers with IDMonitors()

Post by lmstearn » 04 Feb 2023, 06:58

pippo32 wrote:
04 Feb 2023, 05:18
Sorry, I'm a beginner. How do I run the script???
I don't know if it's for me. With hotkeys (for example with CTRL+ALT+\) I would like to open the resource manager on the monitor I'm currently working on, not on the primary monitor.
Welcome to AHK! :)
This script is just a monitor identifier, if you want to launch things in different monitors, try PrgLnch. In there, the launching is done from the gui, no hotkeys at this time.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

Post Reply

Return to “Scripts and Functions (v1)”