Jump to content

Recommended Posts

Howdy, I've gone through a lot of au3 forums, and I once had a working Imagesearch script that I got from here.  However, and i'm just totally not sure how but my imagesearch scripts aren't working anymore.
I'm not new to au3 but i'm not the most experienced with it's syntax/commands.

Anyways, I've looked over the big threads involving imagesearch.

Does anyone have a working Imagesearch x64 for win10 that is currently working as of the date with the post.

Dll's and what not is fine, just when I tell the script to run, I want to be able to find the image on the screen!
Can't find a working copy so if anyone has one please send it my way lol.

I've taken all the imagesearch downloads and what not and have played with them but I can't get any of them working on my end, despite others saying they're working.
Thanks.

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team


"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!

Share this post


Link to post
Share on other sites
On ‎6‎/‎27‎/‎2018 at 12:54 PM, Earthshine said:

under display settings, make sure your Scale and Layout is set to  100% and not more.

I'm fine on that front.  Just waiting for others to reply with working code.  If anyone is experienced enough I can dump the folder that I have that used to be my old working image search.

 

Share this post


Link to post
Share on other sites

Again, without explaining what you are trying to accomplish, it is difficult to assist.


"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!

Share this post


Link to post
Share on other sites

OpenCV match feature could be an alternative to search for an image inside another image

See also this example of image compare:

 

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi Atoxis,

I kind of "wrapped" the ImageSearch command from ... *cough* ... cannot say it out loud in here ... (*whispering*) AutoHotKey ... to an AutoIt function.

Of course a separate dll must be downloaded from here: https://hotkeyit.github.io/v2/
Either one of the dll packages (v1 or v2) should do the trick. Just don't use the help file of v1. It's confusing and misleading. Even the author says on that page that it is outdated. Don't know why it is still packaged with the v1 zip package. So make sure to at least download v2 for the help file. And, if you want it, v1 for the possibly more stable version? If you should be using the 32-bit v1 version after all, make sure to be using the "w" version, not the "a".

I am not an expert with dll calls. So the code underneath is the result of trial and error based on reading the help files rather than of always exactly knowing what must be coded. I also did not do much error catching in the code - or none at all - but the code is not so complicated nor long. It also might not be the fastest ImageSearch-code out there, but hey, the code works for me (on Win 8.1 x64 and with both 32-bit and 64-bit AutoIt) and I think it is fairly simple to implement. But I am willing to work on improving the code upon feedback. (The additional plus of this code is that you can practically wrap any ahk command or fuction to AutoIt by copying and slightly adapting the code. Not that there would be much need for that but who knows, maybe tomorrow one of us stumbles upon another case like ImageSearch.)

Hope it helps either you, Atoxis, or someone else in the future.
Regards, S.
 

$searchAreaX1 = xxxxx ;//upper left X value of search area
$searchAreaY1 = yyyyy ;//upper left Y value of search area
$searchAreaX2 = xxxxxx ;//lower right X value of search area
$searchAreaY2 = yyyyyy ;//lower right Y value of search area
$OptionsAndImageFile = "..." ;//e.g. "*20 *TransBlack (relative) path to image.png", see https://www.autohotkey.com/docs/commands/ImageSearch.htm
;~ $ImageSearchCoordMode = "..." ;//Specify whether all coordinates are relative to "Screen|Window|Client". Can be skipped. Default is "Window" (meaning the one active while the ImageSearch function runs). see also https://www.autohotkey.com/docs/commands/CoordMode.htm

WinActivate(".......", "") ;//if coordinates are relative to window, it makes sense to activate the desired window before performing the search
WinWaitActive("[LAST]")

$imageFoundAt = ImageSearch_ahk_wrapped($searchAreaX1, $searchAreaY1, $searchAreaX2, $searchAreaY2, $OptionsAndImageFile)
If $imageFoundAt[0] Then
    MsgBox(0, "ImageSearch results", "Image found at the coordinates: X " & $imageFoundAt[0] & ", Y " & $imageFoundAt[1])
Else
    MsgBox(0, "ImageSearch results", "Image not found.")
EndIf


;// VVV BEGINNING OF "WRAPPER"-FUNCTION: VVV
Func ImageSearch_ahk_wrapped($searchAreaX1, $searchAreaY1, $searchAreaX2, $searchAreaY2, $OptionsAndImageFile, $ImageSearchCoordMode = "Window")

;// >>> IN THE NEXT 4 LINES OF CODE CHOOSE THE DLL OF YOUR CHOICE SO THAT IT FITS THE BIT-VERSION OF YOUR DESIRED AUTOIT.EXE BY COMMENTING THE OTHER LINES OUT. THIS WAY THE CODE CAN BE REUSED/REVISITED AND QUICKLY ADAPTED.
;// >>> IN THE NEXT 6 LINES OF CODE ADAPT THE PATHS/STRINGS TO YOUR LOCAL CIRCUMSTANCES.
;~  $path_to_AutoHotkey_dll = ".\ahkdll-v1-release-master\Win32w\AutoHotkey.dll"
;~  $path_to_AutoHotkey_dll = ".\ahkdll-v1-release-master\x64w\AutoHotkey.dll"
;~  $path_to_AutoHotkey_dll = ".\ahkdll-v2-release-master\Win32w\AutoHotkey.dll"
    $path_to_AutoHotkey_dll = ".\ahkdll-v2-release-master\x64w\AutoHotkey.dll"
    
    $part_of_path_identifying_version1 = "ahkdll-v1-release-master"
    $part_of_path_identifying_version2 = "ahkdll-v2-release-master"

    $hDll = DllOpen($path_to_AutoHotkey_dll)

    DllCall($hDll, "UINT_PTR:cdecl", "ahkdll", "wstr", "", "wstr", "", "wstr", "")
    If StringInStr($path_to_AutoHotkey_dll, $part_of_path_identifying_version1) Then
        DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "CoordMode Pixel, " & $ImageSearchCoordMode)
        DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "ImageSearch foundX, foundY, " & $searchAreaX1 & ", " & $searchAreaY1 & ", " & $searchAreaX2 & ", " & $searchAreaY2 & ", " & $OptionsAndImageFile)
    ElseIf StringInStr($path_to_AutoHotkey_dll, $part_of_path_identifying_version2) Then
        DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "CoordMode ""Pixel"", """ & $ImageSearchCoordMode & """")
        DllCall($hDll, "BOOLEAN:cdecl", "ahkExec", "wstr", "ImageSearch foundX, foundY, " & $searchAreaX1 & ", " & $searchAreaY1 & ", " & $searchAreaX2 & ", " & $searchAreaY2 & ", """ & $OptionsAndImageFile & """")
    EndIf
    $foundX = DllCall($hDll, "wstr:cdecl", "ahkgetvar", "wstr", "foundX", "UInt", 0)
    $foundY = DllCall($hDll, "wstr:cdecl", "ahkgetvar", "wstr", "foundY", "UInt", 0)
    Local $returnArray[2]
    $returnArray[0] = $foundX[0]
    $returnArray[1] = $foundY[0]

    DllClose($hDll)

    Return $returnArray
EndFunc

 

 

Edited by autocart

Share this post


Link to post
Share on other sites

Make sure you test with screen scale set to 100% Then test with different scale. I have struggled with some code comparing images. Turned out capturing code got offset when screen scale was not 100%. I gave up on ImageSearch.dll 3 months ago. Could be the same problem.

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

  • Similar Content

    • By LTNhanSt94
      Today, I will share my work with image search in inactive windows (windows that run in the background) with tolerances (variations).
      After a long time of searching and using image search UDF on the internet. I combined all of that with my experienced and created a UDF name HandleImgSearch.
      I have embedded the .dll file in this script so it doesn't need any external files, just include it and run. However, this UDF have a feature that will make it run slower is $MaxImg variable, this variable will allow you to return multiple positions of a finding image.
      Some highlights:
      Very fast with imagesearchdll embedded, no external files required. Tolerances and Max Images are supported. Optimized. Use with handle or full screen easily. Included global functions, so you can run multiple functions in one capture. Examples used for testing included. Notes:
      Image use for searching should be a "24-bit Bitmap" format. I included $IsUser32 variable in some places like _GlobalImgInit, _HandleCapture. This variable allowed you to use DllCall with "PrintWindow" parameter instead of _WinAPI_BitBlt with $SRCCOPY. $IsUser32 = True is useful for window explorer handle, $IsUser32 = False is useful for the emulator handle (NoxPlayer handle example included). If hwnd parameter equal "", it will use hold screen instead. Functions:
      Global Functions: Run multiple functions with one capture. _GlobalImgInit: Initialization variables. _GlobalImgCapture: Capture the handle. _GlobalGetBitmap: Get captured bitmap handle. _GlobalImgSearch: This is the main function of this UDF. _GlobalGetPixel: Get pixel color in captured image. _GlobalPixelCompare: Compare pixel color with captured image pixel color. Handle Functions: Capture every time. _HandleImgSearch: This is the main function of this UDF. Search for images in the handle of the window with the tolerance and maximum image options. _BmpImgSearch: Search picture in picture instead of handle. _HandleGetPixel: Get pixel in handle image. _HandlePixelCompare: Compare color with pixel color of handle image. _HandleCapture: Capture handle screen. Source code: https://github.com/ltnhanst94/HandleImgSearch
      Thanks to:
      ImageSearchDLL (Author: kangkeng 2008) MemoryCall (Author: Joachim Bauch) BinaryCall (Author: Ward) GAMERS - Asking for help with ANY kind of game automation is against the forum rules. DON'T DO IT.
       
       
    • By Synaps3
      I've recently been annoyed by how google images works. You can't click an image and see the full res image. You have to go to the website and find the image on the page and occasionally, it won't allow you to view the image easily. This script makes it easy to view any image in google images in full resolution immediately. You just press Ctrl + Q while hovering over the image you want and it'll open full res in a new tab. This is only tested in firefox, but it shouldn't be hard to modify for another browser.
      Here it is:
      #include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> #include <Clipboard.au3> #include <Array.au3> #include <String.au3> Local $clipB Local $urlArray Local $theLink HotKeySet("^q", "OpenImage") Func DecodeUrl($src) Local $i Local $ch Local $buff ;Init Counter $i = 1 While ($i <= StringLen($src)) $ch = StringMid($src, $i, 1) ;Correct spaces If ($ch = "+") Then $ch = " " EndIf ;Decode any hex values If ($ch = "%") Then $ch = Chr(Dec(StringMid($src, $i + 1, 2))) $i += 2 EndIf ;Build buffer $buff &= $ch ;Inc Counter $i += 1 WEnd Return $buff EndFunc ;==>DecodeUrl Func OpenImage() MouseClick($MOUSE_CLICK_RIGHT) Send("A") Sleep(100) $clipB = _ClipBoard_GetData($CF_TEXT) $theLink = DecodeUrl($clipB) $urlArray = _StringBetween($theLink, "=", "&") If StringInStr($urlArray[0], "?") <> 0 Then $urlArray = _StringBetween($theLink, "=", "?") EndIf ShellExecute($urlArray[0]) EndFunc While 1 Wend  
    • By Schuster
      Hey there,
      i need your help guys. I am working in the QA department of my company. A little part of or software produces hints (like little popups) which needs to be tested every release. I wrote scripts to trigger those hints and i also implemented the imagesearch.dll to find those hints on the screen. My goal now is it to let the machine work over night, so when i come back to work i only get a report which says 130/140 hints were found successfully. This already works, aslong as my pc is not locked, but i want/need to lock my pc because of security concerns.
      My general question. Is it possible to run my scripts on my locked PC and still find an image that i provide which will open sooner or later in the background?
       
      Thanks in advance
×
×
  • Create New...