rimmi2002 Posted May 17, 2017 Posted May 17, 2017 Hi I am writing a script and I'd like it to behave differently based on the # on monitors attached. Is there a way to find this out by an Autoit command? Thanks.
Subz Posted May 17, 2017 Posted May 17, 2017 Look at the _WinAPI_EnumDisplayMonitors() function, the top line returned gives you the count of monitors.
Malkey Posted May 17, 2017 Posted May 17, 2017 Also see _WinAPI_GetSystemMetrics() #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Array.au3> ; From https://www.autoitscript.com/forum/topic/134534-_desktopdimensions-details-about-the-primary-and-secondary-monitors/ Local $a[] = [_WinAPI_GetSystemMetrics($SM_CMONITORS), _ ; Number of monitors. _WinAPI_GetSystemMetrics($SM_CXSCREEN), _ ; Width or Primary monitor. _WinAPI_GetSystemMetrics($SM_CYSCREEN), _ ; Height or Primary monitor. _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN), _ ; Width of the Virtual screen. _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)] ; Height of the Virtual screen. ConsoleWrite("Number of monitors = " & _WinAPI_GetSystemMetrics($SM_CMONITORS) & @CRLF) _ArrayDisplay($a)
NaX Posted January 15, 2018 Posted January 15, 2018 (edited) (a bit late but good information) _WinAPI_GetSystemMetrics(80) gives you the number of active monitors #NoTrayIcon #include <WinAPI.au3> $aDevice = _WinAPI_GetSystemMetrics(80) if $adevice = 1 Then ... (enter your intended action here if one monitor is present) EndIf Edited January 15, 2018 by NaX clarity
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now