Sign in to follow this  
Followers 0
drtrann

simple image search not functioning

4 posts in this topic

#1 ·  Posted (edited)

hello guys,

im sorry that im going to have to post another one of these threads but i've scoured the internet attempting to find out why my imagesearch test isnt functioning. this is literally a copy paste of a functioning example i found but even this doesnt work ;)

#include 'ImageSearch.au3'
HotKeySet("s", "Start")
$x = 0
$y = 0
Func Start()
$Search = _ImageSearch('test.JPG',0,$x,$y,0)
   If $Search=1 Then
   MouseMove($x,$y,10)
   Else
   MsgBox(0,"","fail")
   EndIf
  
EndFunc
while 1
   Sleep(100)
WEnd

as you can see this is an incredibly simple script to look for an icon that resides on my desktop. the image its looking for is 10x10 of the center icon. but it is constantly returning with a fail :) the only thing i can think of is that the image file is somehow wrong, but i've redone it 5+ times and even tried multiple different ways of executing _ImageSearch, ultimately to the same exact issue.

thank you for any help with this issue i do appreciate it :)

Edited by drtrann

Share this post


Link to post
Share on other sites



this is the image search function i always use and it always works if the image is there:

_Imagesearcharea("Images/Icon.PNG",1,0,0,@DesktopWidth,@DesktopHeight,$x,$y,100)

here are the parameters: Image, returned position (1 = center of the image, 0 = top left corner), Left, top, right, bottom, returned x position, returned y position, tolerance)

now, this function searches the whole screen and the image you r using is not one of the supported types. bitmap or png

Share this post


Link to post
Share on other sites

you sir are my hero.... 16 hours wasted to be fixed in 5 seconds ;D *tip of the hat

Share this post


Link to post
Share on other sites

you sir are my hero.... 16 hours wasted to be fixed in 5 seconds ;D *tip of the hat

its the little things that always mess us up right?? ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0