Jump to content
kangkeng

Image Search Library

Recommended Posts

Hey. Great library. I just made some chages, so i can search any HBitmap, too :) ( _WinAPI_LoadImage, _GDIPlus_BitmapCreateHBITMAPFromBitmap) :)

Posted Image ImageSearch.zip (659.4K) Number of downloads: Posted Image

//Edit: added speedshare mirror as requested by mortelrdv: http://www.speedshare.org/download.php?id=5B284B0413

Now it is here: Download for mod

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Hey. Great library. I just made some chages, so i can search any HBitmap, too :) ( _WinAPI_LoadImage, _GDIPlus_BitmapCreateHBITMAPFromBitmap) :)

Posted Image ImageSearch.zip (659.4K) Number of downloads: Posted Image

Hello! Any idea on how this works while looking for an image? I'm experiencing difficulties while looking for a certain cursor image.Does it look at the cursor while searching or behind it only?Thanks!

Share this post


Link to post
Share on other sites

No, i don't know, how this works...

but i think, it looks behind the cursor (like _ScreenCapture_Capture, where the cursor is only added if you want it)

//Edit: so you could use _ScreenCapture_Capture with the modified dll and the cursor would be there)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

No, i don't know, how this works...

but i think, it looks behind the cursor (like _ScreenCapture_Capture, where the cursor is only added if you want it)

//Edit: so you could use _ScreenCapture_Capture with the modified dll and the cursor would be there)

Yes, I guess I could do that, but it would probably be too slow for my purpose.I need to look for an object in an area.And the object is dynamic, its graphic changes, so the only way to look for it in an area is move the cursor and look at its shape, because it changes shape while over that object.Capturing the image, saving it, and looking through that image for every let's say 5 pixels in a pretty large area would probably take too long...Maybe there's a different way I could look for the cursor though...

Anyway, thanks for the fast answer!

Share this post


Link to post
Share on other sites

I've been working with ImageSearch for a few days on a project and thus far I've had great success until I tried to make it find a small image on a side monitor. It seems that imagesearch by default only searches on the primary monitor. Is there a way to expand it to look on all monitors?

Thanks.

Share this post


Link to post
Share on other sites

Added a mirror fpr HBITMAP veriosn: http://www.speedshare.org/download.php?id=5B284B0413

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Added a mirror fpr HBITMAP veriosn: http://www.speedshare.org/download.php?id=5B284B0413

Hello! Came across an issue with imagesearcharea().It seems that even though I specify a search rectangle, it still looks at the whole screen, or at least at the full part of the screen that's to the right and down of the screen starting from the initial coordinates.Any ideas why?

Thanks!

Share this post


Link to post
Share on other sites

I have got error :

!>13:53:19 AutoIT3.exe ended.rc:-1073741819

on example code. Any solution ?

EDIT: Yay didn't change dll file. Sorry :)

EDIT2: Script is working fine! Great job for me.... But it would be brilliant if it could return array of all items found with ...coords of course. :o .

Edited by jasny

Share this post


Link to post
Share on other sites

Hi there

Well I have an issue and I was wondering if any of you had ideas or answers.

Let me explain you. I've been using ImageSearch.au3 UDF and it works like a charm on my Windows XP. However the script I made is for someone under Vista and I suspect this is the problem here since for her it simply doesn't work (from what I understood the script doesn't even start).

So here are my thinkings, is there anything to do to make an autoit script compatible with Vista (I don't have Vista and don't even own a copy so I can't test :-( ) or is due to the ImageSearchDLL.dll not working on Vista ? and any idea how to make this work on Vista? the question has been asked in the thread but no answer yet

Thank you!

Edited by AndyCody

Share this post


Link to post
Share on other sites

Hi there

Well I have an issue and I was wondering if any of you had ideas or answers.

Let me explain you. I've been using ImageSearch.au3 UDF and it works like a charm on my Windows XP. However the script I made is for someone under Vista and I suspect this is the problem here since for her it simply doesn't work (from what I understood the script doesn't even start).

So here are my thinkings, is there anything to do to make an autoit script compatible with Vista (I don't have Vista and don't even own a copy so I can't test :-( ) or is due to the ImageSearchDLL.dll not working on Vista ? and any idea how to make this work on Vista? the question has been asked in the thread but no answer yet

Thank you!

ImageSearch.dll is working on WinVista in my case. :)

Share this post


Link to post
Share on other sites

Hallo,

I use the ImageSearch function ang it works :)

But I want use the ImageSearchDLL.dll for my Pythonproject and in this case i must register the dll. I try to register this file with the regsvr32 command but i get the error: "ImageSearchDLL.dll was loaded, but the DllRegisterServer entry point was not found. This file can not be registered."

It is possible that the author of the dll file modify this file?

Share this post


Link to post
Share on other sites

ImageSearch is a Win32 API DLL, not a COM-Dll. So you have to use ctypes


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

ok

i have the follow code:

from ctypes import *

mydll = CDLL('ImageSearchDLL.dll)

imgSearch = mydll.ImageSearch

and now, how can I use the function?

When i type:

result = imgSearch("img.bmp", 1, 0, 0, 0) i get a WindowsError: exception: access violation reading 0x00000000

Share this post


Link to post
Share on other sites

ok

i have the follow code:

from ctypes import *

mydll = CDLL('ImageSearchDLL.dll)

imgSearch = mydll.ImageSearch

and now, how can I use the function?

When i type:

result = imgSearch("img.bmp", 1, 0, 0, 0) i get a WindowsError: exception: access violation reading 0x00000000

This works for me.

from ctypes import *
import win32api

ImageSearchDLL = windll.LoadLibrary("ImageSearchDll")
ImageSearch = ImageSearchDLL.ImageSearch
imageFile = 'myImage.bmp'
searchReturn =  c_char_p(ImageSearch(0,0,1024,1024,imageFile))

print search_return #shows c_char_p representation
print repr(string_at(search_return,21)) #shows string representation, need to fix the 21 to some sort of str_len function
Edited by chogan

Share this post


Link to post
Share on other sites

ImageSearch.au3 not work under Windows 7 x64 if AutoIt3_x64.exe used!

ERROR

Line 40 ...ImageSearch.au3

if $result[0]="0" then return 0

if $result^ ERROR

Error: Subscript used with non-Array variable

If run under AutoIt3.exe - all ok!

Edited by dkrichun

Share this post


Link to post
Share on other sites

#include <ImageSearch.au3>

$x1=0
$y1=0

$result = _ImageSearch("recycle.bmp",1,$x1,$y1,0)
if $result=1 Then
    MouseMove($x1,$y1,3)
    MsgBox(0,"Found","Found a recycle bin with stuff here...")
EndIf

$result = _ImageSearchArea("recycle.bmp",1,0,0,200,200,$x1,$y1,0)
if $result=1 Then
    MouseMove($x1,$y1,3)
    MsgBox(0,"Found","Found a recycle bin with stuff in top left corner")
EndIf
The reason to that only this is working, is that

While 1
Sleep(1000)
WEnd

will make the bot sleep 1000 MS all the time, which means it doesn't get to do other things. Why did you add it in your code in the first place? Completely useless :party:

Btw. Thanks, will try this out! :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...