Is it possible to detect when monitor is plugged in?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omar
Posts: 540
Joined: 22 Oct 2015, 17:56

Is it possible to detect when monitor is plugged in?

15 Mar 2018, 09:43

I want some code to detect if a monitor is plugged into my pc. Either hdmi or vga port

Just wondering

Thanks
Marrow
Posts: 21
Joined: 02 Oct 2017, 06:31

Re: Is it possible to detect when monitor is plugged in?

15 Mar 2018, 10:16

Hi Omar,
I don't know whether there is a direct way to find out. You can try by checking the (virtual) screen resolution, if it increased, there is an additional monitor: https://autohotkey.com/docs/Variables.htm#Screen
A workaround for the question hdmi or vga could be via the device name. If you connect a monitor via VGA, it's usually just called PnP-Monitor. If it's connected via HDMI, it has the correct name (e.g. Acer Hd193W)
User avatar
Micromegas
Posts: 260
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: Is it possible to detect when monitor is plugged in?

15 Mar 2018, 11:22

SysGet gives you, in addition to the device name, more valuable information, such as the MonitorCount and the bounding coordinates of each monitor.
omar
Posts: 540
Joined: 22 Oct 2015, 17:56

Re: Is it possible to detect when monitor is plugged in?

15 Mar 2018, 14:01

thanks guys.
i checked on python and many are frustrated because there is no easy method to detect
instead, they constantly have to poll to get data - which uses up resources

the methods mentioned, i assume needs polling?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: fiendhunter and 240 guests