Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

ImageSearch Coordinates


  • Please log in to reply
1 reply to this topic
WHLibrarian
  • Members
  • 3 posts
  • Last active: Oct 31 2015 07:25 PM
  • Joined: 25 Oct 2015

It's not amazingly well written but I often switch from one computer to another and have to adjust all my imagesearch coordinates (since tighter coordinates GREATLY improve speed) so I use this to both verify that the image is correct and the exact coordinates. I know bad coordinates are one of the many simple errors you can run into with ImageSearch that make it hard to track down why your script isn't working.

#K::
X=0
Y=0
XX=0
YY=0
FileSelectFile, SearchImage
Loop
{
ToolTip, Initial Search`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    Break
  If ErrorLevel = 1
    {
    XX := XX + 5
    YY := YY + 5
    }
}
Loop
{
ToolTip, Focus XX`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    XX := XX - 5
    }
  If ErrorLevel = 1
    {
    XX := XX + 5
    Break
    }
}
Loop
{
ToolTip, Focus YY`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    YY := YY - 5
    }
  If ErrorLevel = 1
    {
    YY := YY + 5
    Break
    }
}
Loop
{
ToolTip, Focus X`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    X := X + 5
    }
  If ErrorLevel = 1
    {
    X := X - 5
    Break
    }
}
Loop
{
ToolTip, Focus Y`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    Y := Y + 5
    }
  If ErrorLevel = 1
    {
    Y := Y - 5
    Break
    }
}
Loop
{
ToolTip, Focus XX`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    XX := XX - 1
    }
  If ErrorLevel = 1
    {
    XX := XX + 1
    Break
    }
}
Loop
{
ToolTip, Focus YY`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    YY := YY - 1
    }
  If ErrorLevel = 1
    {
    YY := YY + 1
    Break
    }
}
Loop
{
ToolTip, Focus X`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    X := X + 1
    }
  If ErrorLevel = 1
    {
    X := X - 1
    Break
    }
}
Loop
{
ToolTip, Focus Y`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%
ImageSearch, , , X, Y, XX, YY, *Trans0xF7E8EE *50 %SearchImage%
  If ErrorLevel = 2
    MsgBox Image File Not Found
  If ErrorLevel = 0
    {
    Y := Y + 1
    }
  If ErrorLevel = 1
    {
    Y := Y - 1
    Break
    }
}
Tooltip, Complete - Image Found`nX=%X%`nY=%Y%`nXX=%XX%`nYY=%YY%

return



LarryC
  • Members
  • 68 posts
  • Last active: Aug 14 2016 07:53 PM
  • Joined: 28 Oct 2012

Last summer I spent hours tightening up the search region on three scripts. So when I seen your script, I realized I could test it, or test my coordinates. Your script was spot on, and now is one of my tools.  Thank you.