Fir3man Posted October 4, 2014 Share Posted October 4, 2014 Hi, I can't fix problem with autoit library. Its stop working in new versions of autoit. I downloaded library from this page. When I try to compile script I get error I fix it with changing declaration of functions like this: Func _ImageSearch(ByRef $x, ByRef $y,$findImage,$resultPosition,$tolerance, $HBMP=0) After that I get 2 different errors: 1) when I'm using 32bit version of DLL: !>12:54:03 AutoIt3.exe ended.rc:-1073741819 2) when I'm using 64bit vertion of DLL: $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) $result is always = 0; And its not an array, just variable = 0. I'm using 64bit Windows 8.1 (had similar problems at win 7 x64). I compile my scrips at 32 bit always. Sorry for My English, I hope more experience programmers will help me. Thank you. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 4, 2014 Developers Share Posted October 4, 2014 Are you sure you can simply change the parameters of the Func? Show your total code which gave the initial error so we can have a look. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Fir3man Posted October 5, 2014 Share Posted October 5, 2014 expandcollapse popup#include-once ;#include <Array.au3> ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with Image Search ; Require that the ImageSearchDLL.dll be loadable ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Find the position of an image on the desktop ; Syntax: _ImageSearchArea, _ImageSearch ; Parameter(s): ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; ; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify ; a desktop region to search ; ;=============================================================================== Func _ImageSearch(ByRef $x, ByRef $y,$findImage,$resultPosition,$tolerance, $HBMP=0) return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP) EndFunc Func _ImageSearchArea(ByRef $x, ByRef $y,$findImage,$resultPosition,$x1,$y1,$right,$bottom, $tolerance,$HBMP=0) ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom) if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage If IsString($findImage) Then $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) Else $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"ptr",$findImage,"ptr",$HBMP) EndIf ; If error exit ConsoleWrite($result&@CRLF) ;_ArrayDisplay($result) if $result[0]="0" then return 0 ; Otherwise get the x,y location of the match and the size of the image to ; compute the centre of search $array = StringSplit($result[0],"|") $x=Int(Number($array[2])) $y=Int(Number($array[3])) if $resultPosition=1 then $x=$x + Int(Number($array[4])/2) $y=$y + Int(Number($array[5])/2) endif return 1 EndFunc ;=============================================================================== ; ; Description: Wait for a specified number of seconds for an image to appear ; ; Syntax: _WaitForImageSearch, _WaitForImagesSearch ; Parameter(s): ; $waitSecs - seconds to try and find the image ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; ; ;=============================================================================== Func _WaitForImageSearch(ByRef $x, ByRef $y,$findImage,$waitSecs,$resultPosition,$tolerance,$HBMP=0) $waitSecs = $waitSecs * 1000 $startTime=TimerInit() While TimerDiff($startTime) < $waitSecs sleep(100) $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance,$HBMP) if $result > 0 Then return 1 EndIf WEnd return 0 EndFunc ;=============================================================================== ; ; Description: Wait for a specified number of seconds for any of a set of ; images to appear ; ; Syntax: _WaitForImagesSearch ; Parameter(s): ; $waitSecs - seconds to try and find the image ; $findImage - the ARRAY of images to locate on the desktop ; - ARRAY[0] is set to the number of images to loop through ; ARRAY[1] is the first image ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns the index of the successful find ; On Failure - Returns 0 ; ; ;=============================================================================== Func _WaitForImagesSearch(ByRef $x, ByRef $y,$findImage,$waitSecs,$resultPosition,$tolerance,$HBMP=0) $waitSecs = $waitSecs * 1000 $startTime=TimerInit() While TimerDiff($startTime) < $waitSecs for $i = 1 to $findImage[0] sleep(100) $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP) if $result > 0 Then return $i EndIf Next WEnd return 0 EndFunc Did you have similar errors like me? I mean with that ByRef part. I use example code to call func #include "ImageSearch.au3" HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch($x, $y,"checkImage.png", 0, 100) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd Link to comment Share on other sites More sharing options...
Eya Posted November 12, 2014 Share Posted November 12, 2014 I tried the code posted by tbodine88 () to help in debug, but it always return 1 - where it cant use the DLL. Im using 64 bit. I tried 32 bit but it is not working. can someone help pls? how can i have this work for me? thanks Link to comment Share on other sites More sharing options...
xadi Posted November 25, 2014 Share Posted November 25, 2014 Unfortunately, ImageSearch does not work for me neither. #include <ImageSearch.au3> global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('./00-login.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc HotKeySet("p", "checkForImage") while 1 sleep(200) WEnd After I run it - DLL library crashes. Did anyone manage to fix the problem? Link to comment Share on other sites More sharing options...
rm65453 Posted November 28, 2014 Share Posted November 28, 2014 (edited) Don't want to hijack the threat but since I am having very similar problems thought I should just add it to this thread instead of creating a new one. The script runs fine with the x64 dll and au3 file but the trouble is the result is always 0. I have only tidied the imagesearch file and then complied the following code using autoit_x64 compiler. #include <ImageSearch.au3> #include <GDIPlus.au3> $fileA = "full path to the file\meeting.bmp" _GDIPlus_Startup() $hImageA = _GDIPlus_ImageLoadFromFile($fileA) ;this is the firefox icon use something else if you don't have it. $hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA) $x = 0 $y = 0 $result = _ImageSearch($hBitmapA, 1, $x, $y, 20) ;Zero will search against your active screen If $result > 0 Then MouseMove($x, $y) MsgBox (0, "Result", $Result) EndIf MsgBox (0, "Result", $Result) _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown() any help would be much appreciated. it only worked once after I downloaded the demo file but since then it has stopped working completely. edit: I added the debug lines to the imagesearch.au3 file as well and didnt get any errors (which I believe is good) but the result is always, as previously stated, 0. Edited November 28, 2014 by rm65453 Link to comment Share on other sites More sharing options...
rm65453 Posted November 28, 2014 Share Posted November 28, 2014 Sorry about multiple posts but I am not able to edit my previous post. So somehow using the standalone Aut2Exe v3 and compiling it under x86 works (using the 32 bit files). Still no luck with the 64 bit though which is fine except for the fact that the exe file crashes after most runs. here are the error details Files that help describe the problem: C:\Users\username\AppData\Local\Temp\WERA988.tmp.WERInternalMetadata.xml C:\Users\username\AppData\Local\Temp\WERBF79.tmp.appcompat.txt C:\Users\username\AppData\Local\Temp\WERBFE7.tmp.mdmp Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\system32\en-US\erofflps.txt Link to comment Share on other sites More sharing options...
rm65453 Posted November 28, 2014 Share Posted November 28, 2014 here are the links to the error files. hopefully someone can point me the source of the error. going to start doing some trouble shooting now. http://www.filedropper.com/wer4cf1tmpwerinternalmetadata http://www.filedropper.com/wer661dtmpappcompat http://www.filedropper.com/wer663dtmp Link to comment Share on other sites More sharing options...
rm65453 Posted December 2, 2014 Share Posted December 2, 2014 ok so I got this to work, somewhat successfully. Turns out it doesn't like mixing png and bmp formats. now the problem I am having is to make it search extended displays. currently it only searches the display with the toolbar underneath. any ideas? Am very close to getting it to work well enough to serve my purpose. Link to comment Share on other sites More sharing options...
Technokrat Posted December 13, 2014 Share Posted December 13, 2014 why this it >.< can anyone help me Link to comment Share on other sites More sharing options...
Maxlvs Posted March 1, 2015 Share Posted March 1, 2015 After having lot of issues myself with getting ImageSearch to work I decided to make topic with explanation how to proper use this script. Here is link of original topic at this topic: '?do=embed' frameborder='0' data-embedContent>> Credits to kangkeng for creating such useful piece of code. Description of parameters from ImageSearch.au3 itself:; Description: Find the position of an image on the desktop ; Syntax: _ImageSearchArea, _ImageSearch ; Parameter(s): ; $findImage - the image to locate on the desktop EndIf EndFunc while 1 sleep(200) WEnd I would like to apologize if by writing this I offended any of member that thinks this script is too simple to even have it explained, it's just as me being new to autoIt it took me so much time getting around errors and making this script to work. Thanks for reading, if you bump on any problems using it post it here, I will try to help you fixing it and update topic for further reference.Download links: 32bit: ImageSearch 32bit.rar 64bit: ImageSearch 64 bit.rar i have a question iam trying to get the image search to work and it says error line 1 #include <ImageSearch.au3> i think because i dont have that downloaded to my library but i tried to download theses and it didnt really do anything how could i get this ? Decibel and blkn 2 Link to comment Share on other sites More sharing options...
JohnOne Posted March 2, 2015 Share Posted March 2, 2015 The links are in the post you quoted. Did you extract it? Did you put it in your script folder? Did you change #include <ImageSearch.au3> to #include "ImageSearch.au3"? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Maxlvs Posted March 7, 2015 Share Posted March 7, 2015 Unfortunately, ImageSearch does not work for me neither. #include <ImageSearch.au3> global $y = 0, $x = 0 Func checkForImage(main.bmp) Local $search = _ImageSearch('main.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc HotKeySet("p", "checkForImage") while 1 sleep(200) WEnd After I run it - DLL library crashes. Did anyone manage to fix the problem? where do i put the image and i put the imagesearch file in the include folder or do i put it the script folder because the script complies but when i click go to run it it wont move the mouse or hit the p hot key still to run but it gives me >"E:DownloadAutoIt3SciTE..autoit3.exe" /ErrorStdOut "E:DownloadFindIMG.au3" "E:DownloadFindIMG.au3" (5) : ==> Expected a variable in user function call.: Func checkForImage(main.bmp) Func checkForImage(^ ERROR >Exit code: 1 Time: 0.3234 Link to comment Share on other sites More sharing options...
Maxlvs Posted March 7, 2015 Share Posted March 7, 2015 iam not 100% sure what place your suspost to save the image Link to comment Share on other sites More sharing options...
nullschritt Posted March 12, 2015 Share Posted March 12, 2015 It would be nice to have the functionality to search for images in another image, I'm thinking this could lead to some basic facial recognition, if anyone wanted to take ti there, among other uses. Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 26, 2015 Share Posted March 26, 2015 (edited) I wanted to start looking at this, no luck so far. Just the most basic example I can think of. Took a screenshot of an icon on my deskto and named it VMWare.bmp and put it in the script dir. Used the same code as the first page example with a bit of added tollerance and I get an error. ** Line 44 if $result[0]="0" then return 0 Error: Subscrit used on non-accessible varible. ** Code: #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y=0, $x=0 Func checkForImage() Local $search = _ImageSearch("VMWare.bmp", 1, $x, $y, 10) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc While 1 Sleep(200) WEnd I have tried the 32bit and 64bit dll + udf and put them in the autoit Include folder and the scripts directory both will recreate the issue unless I use the 32bit dll in the script folder it crashes autoit outright. Edited March 26, 2015 by ViciousXUSMC Link to comment Share on other sites More sharing options...
BrewManNH Posted March 26, 2015 Share Posted March 26, 2015 This UDF has no error checking in it, you'd need to add some so that you won't get those errors. For example test $result to see if it is an array before acting on it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 26, 2015 Share Posted March 26, 2015 (edited) Yeah I was doing some error checking. I got the script working without error, just not functioning properly/well. I had to use the x64 udf and dll and then right click and explicitly tell the script to run as x64 then no errors occured but the image was not being found. I bumped up the tolerance higher and higher until around 150 it found something but not the image it should have found. I'll experiment with different image captures and see if I can get it working better. I use a 3 monitor setup and I am searching for an icon on the main monitor, when it finally found something it was nothing close to the image I took a picture of :/ Edit: Larger image works with a 175 tolerance. Took a capture of the entire icon. About a 3 second lag from when I fire the function till when it finds it. Edit2: Working Great now used irfanview to do the screen capture, crop, save instead of the other stuff before that was probably degrading the image quality and resampling it. Edited March 26, 2015 by ViciousXUSMC Link to comment Share on other sites More sharing options...
ShadowEagle Posted March 29, 2015 Share Posted March 29, 2015 Where can I download the most recent dlls for image search? Link to comment Share on other sites More sharing options...
ShadowEagle Posted March 29, 2015 Share Posted March 29, 2015 why this it >.< can anyone help me Im having the same issue, any resolution to it?? local $x1 Local $y1 local $search = _ImageSearch($ImgDir&"image.PNG",1,$x1,$y1,0) if $search=1 Then MouseMove($x1,$y1,3) MsgBox(0,"Found","Found a recycle bin with stuff here...") EndIf running it gives me the error above.... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now