safriduo Posted January 13, 2017 Posted January 13, 2017 every other tutorial is widely outdated or does not work on windows 10. we need something working out of the box. now you look at this and tell me if its working or not? #include <ImageSearch.au3> #include <GDIPlus.au3> $fileA = @ScriptDir & "\testa.png" _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, 0) ;Zero will search against your active screen If $result > 0 Then MouseMove($x, $y) EndIf _GDIPlus_ImageDispose($hImageA) _GDIPlus_Shutdown()
Moderators JLogan3o13 Posted January 13, 2017 Moderators Posted January 13, 2017 Why would we tell you if something is not working for you? If you would like help on this forum, I would suggest approaching it with a better attitude than "This is broken, someone fix it for me now", because (intentionally or otherwise) that is how you're coming across. yutijang 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
safriduo Posted January 13, 2017 Author Posted January 13, 2017 i tried several hours already fine tuning the script only to find its completely broken and not working whatsoever.
safriduo Posted January 14, 2017 Author Posted January 14, 2017 you guys, we need working imagesearch for win10...
Moderators JLogan3o13 Posted January 14, 2017 Moderators Posted January 14, 2017 @safriduo please do not bump your posts without waiting 24 hours. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
aa2zz6 Posted January 14, 2017 Posted January 14, 2017 Maybe search the forums and you'll find something that "maybe" works..
careca Posted January 14, 2017 Posted January 14, 2017 Using the image from the example #include <ImageSearch.au3> Local $HBMP = 0 Local $x1 = 0, $y1 = 0 Local $right = @DesktopWidth Local $bottom = @DesktopHeight Local $findImage = @ScriptDir&'\Capture.PNG' While 1 $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) If $result[0]<>0 Then $array = StringSplit($result[0],"|") ConsoleWrite('XPos - '& $array[2] &' - YPos - '& $array[3] &' - XSize - '&$array[4]&' - YSize - '&$array[5]&@CRLF) EndIf Sleep(100) WEnd Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
junkew Posted January 15, 2017 Posted January 15, 2017 Alternative is findbmp in examples section FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
jmaruca Posted October 27, 2018 Posted October 27, 2018 Hi Careca, I tried using your code Posted January 15, 2017 and returned the following error on Windows 10; it just doesn't locate the icon, any suggestions?, thank you. >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\AutoIT\TTTTT.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop "D:\AutoIT\TTTTT.au3" (9) : ==> Subscript used on non-accessible variable.: If $result[0]<>0 Then If $result^ ERROR ->17:46:55 AutoIt3.exe ended.rc:1 +>17:46:55 AutoIt3Wrapper Finished. >Exit code: 1 Time: 0.9823
careca Posted October 27, 2018 Posted October 27, 2018 Hi, this means there's an error, the function (dll call) is supposed to retrieve an array, and it's not, so we need to know what is the error. #include <ImageSearch.au3> Local $HBMP = 0 Local $x1 = 0, $y1 = 0 Local $right = @DesktopWidth Local $bottom = @DesktopHeight Local $findImage = @ScriptDir&'\Capture.PNG' While 1 $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) If @error Then MsgBox(64 + 262144, '$result', @error);This shows the error number. If $result[0]<>0 Then $array = StringSplit($result[0],"|") ConsoleWrite('XPos - '& $array[2] &' - YPos - '& $array[3] &' - XSize - '&$array[4]&' - YSize - '&$array[5]&@CRLF) EndIf Sleep(100) WEnd Then you check what is the error number in remarks Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
jmaruca Posted October 28, 2018 Posted October 28, 2018 Hi Careca, OK, it returns an Error = 1 which is: (1 = unable to use the DLL file,); I am not sure how to resolve this; could it be that the DLL is corrupt of something like that?, thank you.
careca Posted October 28, 2018 Posted October 28, 2018 Is it the same dll as this? Does the name in the script correspond to the filename? ImageSearchDLL.dll Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
jmaruca Posted October 29, 2018 Posted October 29, 2018 Hi Careca, Yes, that is correct: ImageSearchDLL.dll is the filename that is in the script, thank you.
careca Posted October 29, 2018 Posted October 29, 2018 Local $HBMP = 0 Local $x1 = 0, $y1 = 0 Local $right = @DesktopWidth Local $bottom = @DesktopHeight Local $findImage = @ScriptDir&'\Capture.PNG' ConsoleWrite('$right - '& $right &' $bottom - '&$bottom&@CRLF) If FileExists($findImage) Then MsgBox(64 + 262144, 'Found', 'File Path: '& $findImage) Else MsgBox(64 + 262144, 'Failed', 'Could not find image') Exit EndIf While 1 $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) If Not @error Then If $result[0]<>0 Then $array = StringSplit($result[0],"|") ConsoleWrite('XPos - '& $array[2] &' - YPos - '& $array[3] &' - XSize - '&$array[4]&' - YSize - '&$array[5]&@CRLF) EndIf Else MsgBox(64 + 262144, 'Failed', 'Dll call Failed, error: '&@error) Exit EndIf Sleep(100) WEnd Let's try to see if there's a wrong parameter in the dllcall. Mainly if the script can find the image and the screen resolution matches. use the attached files as they work here, let's see if you can make it work there. Just open the image and the script should output the coords to console. If this is ok, then we can move on to the gdi functions. ImageSearchDLL.dll Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
jmaruca Posted November 2, 2018 Posted November 2, 2018 Hi Careca, Sorry for taking so long to respond. I tried the code above, when executing, it found the .PNG file then presents the following error: Dll call Failed, error: 1 the DLL is definitely there, thoughts?, thank you.
careca Posted November 2, 2018 Posted November 2, 2018 (edited) Error 1 = unable to use the DLL file I'd say your dll may be corrupted, did you try the one i posted? If you used this one and it still didn't work, i don't know what to say, it's a very weird problem, maybe an antivirus is preventing you to call it? Besides that and the dll being corrupt, i don't see any reason why this would fail. I have win defender so it can't be that, but it may be another AV. Edited November 2, 2018 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Nine Posted November 2, 2018 Posted November 2, 2018 (edited) tried exactly your example, and got the same error (win7 x64 here) @error = 1 with your dll But I just did make one imagesearch of my own and it is working great Edited November 2, 2018 by Nine jmaruca 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
BrewManNH Posted November 2, 2018 Posted November 2, 2018 Are you using the 64 or 32 bit version of the DLL and are you running the script with the same version of AutoIt? 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
jmaruca Posted November 2, 2018 Posted November 2, 2018 Hi Careca, Yes, I downloaded your DLL and disabled my Norton's AV …. you are right, it's a wired problem; I think I may change machines.
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