Has something that I can do with my code to my image search ignore my mouse cursor, if it goes in front of my image, that I'm searching? My image is small and sometimes when my cursor is ahead of it, the image search can't find it anymore.
[Mod edit: Topic moved to 'Gaming'.]
How to ignore mouse cursor in image search
Re: How to ignore mouse cursor in image search
It's likely not an issue with your cursor, but rather a problem with the image changing when you mouse over it.
Like this for example:
Re: How to ignore mouse cursor in image search
No. My cursor doesn't change my image. My cursor is bigger than my image that I'm searching, then when my cursor is over my image, the img search can't find it anymore. it isn't something that will happen always, but I would like to have a solution before it can turn into a problem to me.Hellbent wrote:It's likely not an issue with your cursor, but rather a problem with the image changing when you mouse over it.
Like this for example:
Re: How to ignore mouse cursor in image search
Try:Alternatives:
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=92834
https://www.autohotkey.com/boards/viewtopic.php?t=75867
Code: Select all
SystemCursor("Off")
ImageSearch OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
SystemCursor("On")
;https://autohotkey.com/board/topic/42561-hide-mouse-cursor-when-idle/
SystemCursor(OnOff=1) ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
{
static AndMask, XorMask, $, h_cursor, c, b:= [], h:= [] ; c-sys cur., b-blank cur., h-hwnd of default cur.
if (OnOff = "Init" || OnOff = "I" || $ = "") ; init when requested or at first call
{
VarSetCapacity(h_cursor,4444, 1), VarSetCapacity(AndMask, 32*4, 0xFF), VarSetCapacity(XorMask, 32*4, 0)
, system_cursors:= "32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650"
, c:= StrSplit(system_cursors, ","), $:= "h" ; active default cursors
for i, j in c
h_cursor := DllCall( "LoadCursor", "Ptr",0, "Ptr",j )
, h[i] := DllCall( "CopyImage", "Ptr",h_cursor, "UInt",2, "Int",0, "Int",0, "UInt",0 )
, b[i] := DllCall( "CreateCursor", "Ptr",0, "Int",0, "Int",0
, "Int",32, "Int",32, "Ptr",&AndMask, "Ptr",&XorMask )
}
$:= (OnOff=0||OnOff="Off"||$="h"&&(OnOff<0||OnOff="Toggle"||OnOff="T"))? "b": "h" ; b-blank cur., h-saved cur.
for i, j in c
h_cursor := DllCall( "CopyImage", "Ptr",%$%[i], "UInt",2, "Int",0, "Int",0, "UInt",0 )
, DllCall( "SetSystemCursor", "Ptr",h_cursor, "UInt",j )
}
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=92834
https://www.autohotkey.com/boards/viewtopic.php?t=75867
Re: How to ignore mouse cursor in image search
If it cant find it with the mouse over the image its changing whats on the screen.Fbc wrote: ↑04 Aug 2021, 21:58No. My cursor doesn't change my image. My cursor is bigger than my image that I'm searching, then when my cursor is over my image, the img search can't find it anymore. it isn't something that will happen always, but I would like to have a solution before it can turn into a problem to me.
You may not see it but it doesn't take much when running 0 variation.
You can move the mouse away to 0,0 before performing the ImageSearch.
example:
Code: Select all
CoordMode, Mouse, Screen
MouseMove, 0, 0, 0
Re: How to ignore mouse cursor in image search
Problem is that it's a script that will be running and searching the image for long periods of time. I can't disable my cursor or move to another pixel. If the image shows in the screen the script will do something, but if for any cause my cursor is over there where the image will appear my script will not find it and will not execute my code. What I was thinking was to make my cursor invisible only for the image search, but i think it shouldn't be possible to do that.Xtra wrote: ↑05 Aug 2021, 13:24If it cant find it with the mouse over the image its changing whats on the screen.Fbc wrote: ↑04 Aug 2021, 21:58No. My cursor doesn't change my image. My cursor is bigger than my image that I'm searching, then when my cursor is over my image, the img search can't find it anymore. it isn't something that will happen always, but I would like to have a solution before it can turn into a problem to me.
You may not see it but it doesn't take much when running 0 variation.
You can move the mouse away to 0,0 before performing the ImageSearch.
example:Code: Select all
CoordMode, Mouse, Screen MouseMove, 0, 0, 0
Re: How to ignore mouse cursor in image search
You could also try something like this to keep your cursor away from that spot.
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=69013&p=297586#p297316
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=69013&p=297586#p297316
Re: How to ignore mouse cursor in image search
I was reading the documentation and here they say that cursor is ignored, however gamer cursor doesn't, I think I might set my cursor to use the default cursor not a game cursor and my script is running in a game. Here's what is saying:Hellbent wrote: ↑05 Aug 2021, 19:21You could also try something like this to keep your cursor away from that spot.
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=69013&p=297586#p297316
"The region to be searched must be visible; in other words, it is not possible to search a region of a window hidden behind another window. By contrast, images that lie partially beneath the mouse cursor can usually be detected. The exception to this is game cursors, which in most cases will obstruct any images beneath them."
Who is online
Users browsing this forum: ppu-pro_Res, Shoobis and 45 guests