How to search a image/text in the webpage if the image is appeared more than once

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ivan-mzj
Posts: 4
Joined: 11 Aug 2018, 03:30

How to search a image/text in the webpage if the image is appeared more than once

11 Aug 2018, 03:41

How to search a image/text in the webpage if the image is appeared more than once?
ImageSearch can only find one, how can I find the image/text all
Guest

Re: How to search a image/text in the webpage if the image is appeared more than once

13 Aug 2018, 21:06

trust_me wrote:Take a look at Oldman's code here:

https://autohotkey.com/board/topic/1177 ... ntry676281
Thanks for help!
I've tried the code,but found that the coordinate was always the same one.

SearchImage(ByRef _ix, ByRef _iy, ByRef _x1, ByRef _y1, _x2, _y2, ByRef _image, _options="")
{
static lx1= , liw, lih

if _options
_options .= A_Space

if (lx1 = "")
{
lEnum := GetDetailsOf(_image, [27, 28])
liw := SubStr(lEnum[27], 1, InStr(lEnum[27], "pixels")-2)
lih := SubStr(lEnum[28], 1, InStr(lEnum[28], "pixels")-2)

lx1 := _x1
}

else if (_x1 > lx1)
{
ImageSearch, _ix, _iy, _x1, _y1, _x2, _y1 + lih - 1, % _options _image

if ErrorLevel
{
_x1 := lx1

if (++_y1 > _y2 - lih)
{
lx1=
return false
}
}
else
{
_y1 := _iy

if ((_x1 := _ix + liw) > _x2 - liw)
{
_x1 := lx1

if (++_y1 > _y2 - lih)
_y1 := y2
}

return true
}
}

ImageSearch, _ix, _iy, _x1, _y1, _x2, _y2, % _options _image

if ErrorLevel
{
lx1=
return false
}

_y1 := _iy

if ((_x1 := _ix + liw) > _x2 - liw)
{
_x1 := lx1

if (++_y1 > _y2 - lih)
_y1 := y2
}

return true
}

I can't understand the code that marked use red color.
trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: How to search a image/text in the webpage if the image is appeared more than once

14 Aug 2018, 06:16

Image

On win10 the width / height is returned as line 177 and 179 and not 27 ,28 as on winXP by the GetDetailsOff() function.The code extracts the value from the string.

Oldman later provided a more streamlined function ( but with winXp values)

https://autohotkey.com/board/topic/1203 ... -function/

I tested it on win10 and attached the test images and updated code.
Attachments
red.png
red.png (114 Bytes) Viewed 672 times
test.png
test.png (517 Bytes) Viewed 672 times
old man search.ahk
(6.74 KiB) Downloaded 19 times

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, emp00, Joey5, Rohwedder and 276 guests