I have two monitors.
1. 3840x2160, scale 150%
2. 2560x1440, scale 125%
It is also strange, because below code retrieves the bounding coordinates of the specified monitor:
1. 0,0,2560,1440 (why not 3840,2160???)
2. 3072,0,5120,1152
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SysGet, Mon2, Monitor, 2
MsgBox, Left: %Mon2Left% -- Top: %Mon2Top% -- Right: %Mon2Right% -- Bottom %Mon2Bottom%.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
CoordMode, ToolTip, screen
CoordMode, Mouse, screen
CoordMode, Pixel, screen
;ImageSearch, FoundX, FoundY, Mon2Left, Mon2Top, VirtualWidth, VirtualHeight, G:\testahk.png
ImageSearch, FoundX, FoundY, Mon2Left, Mon2Top, A_ScreenWidth, A_ScreenHeight, *50 G:\testahk.png
if ErrorLevel = 2
MsgBox Could not conduct the image search.
else if ErrorLevel = 1
{
MsgBox Image not found
ExitApp
Return
}
Click, %FoundX%, %FoundY%
MsgBox %FoundX% %FoundY%
ExitApp
Return