Find image and enter it as a text in notepad.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
supplydrop
Posts: 3
Joined: 11 Jan 2019, 18:23

Find image and enter it as a text in notepad.

12 Jan 2019, 12:52

Hello all,

I would like to have a script for continuos image search on specific part of the screen + enter founded image as a text in opened text editor. When previous image is no longer displayed script should clear the line and search again. I have all images on my pc named image01.png, image02.png... Script could convert them into text just like they are named.

I have zero experience with programing so I really need a starting point for this.

Thank you guys!
User avatar
sinkfaze
Posts: 616
Joined: 01 Oct 2013, 08:01

Re: Find image and enter it as a text in notepad.

14 Jan 2019, 08:44

My apologies supplydrop, your reply was queued for moderator approval. Giving a bump now.
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Find image and enter it as a text in notepad.

14 Jan 2019, 13:04

Well, I can't really follow your description, but try first making a simple ImageSearch and see if it works.
Then we can proceed.

Code: Select all

;Loop
;{
  ImageSearch, x, y, 0, 0, 1920, 1080, *100 image1.png
  if ErrorLevel = 0
  {
    MsgBox, Image1 has been found.
    Sleep, 200
  }
;}
return
I commented out the Loop, but if you want to loop it, just remove the ;

I think a good idea would be that you create an Array of your images.
Like:
imageArray := ["image1", "image2"]
and instead of a simple loop, you'll use a for loop for the imagesearch and search for the current image.

Code: Select all

for i in imageArray 
{
   image := imageArray[i] ; Access array elements
   ImageSearch, x, y, 0, 0, 1920, 1080, *100 %image%.png
   if ErrorLevel = 0
   {
      MsgBox, %image% has been found.
      Sleep, 200
   }
}
That's only beta.
And don't forget to add the full path to the images if needed (inside of imagesearch).

Good luck
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
supplydrop
Posts: 3
Joined: 11 Jan 2019, 18:23

Re: Find image and enter it as a text in notepad.

17 Jan 2019, 10:38

I probably mislead you with my description. I need Predefined images recognition on screen -> Conversion into text -> Copying to clipboard script.

Something like:

Value 'image1.png' = text 'image1'
Value 'image2.png' = text 'image2'
...

F1 to start a search on (x, y, w, h).

If 'image1.png' found, copy/paste text 'image1' to (x, y).
If not, search for 'image2'.
...

After X founded images, break.

F2 to clear pasted text on (x, y) and start a script from the beginning.


Less than 100 locally stored, predefined images in total. Is it possible to write something like that for a newbie?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 375 guests