- Install
python3
- Install the python modules
pytesseract
andpyautogui
(using pip)
(note: on Windows you have to also install the tesseract OCR (https://github.com/UB-Mannheim/tesseract/wiki) and add the installation location into the Windows environmental variables PATH
(for me it was C:\Program Files\Tesseract-OCR
))
-
Alter
pytesseract.py
original script (located inC:\Users\username\AppData\Local\Programs\Python\Python36\Lib\site-packages\pytesseract\
on Windows) Inget_tesseract_version()
method there issubprocess.check_output
function. I had to addshell=True
in the arguments list to prevent tesseract from opening a console (even ifpythonw
was used I still had a flashing console appearing) -
Install
AutoHotKey
and runlens-clicker.ahk
in this project directory. -
Now Alt + Shift + s should work
After the keychords is pressed, the script :
- right click (where the mouse is)
- screenshot
- crop a reduced region (to avoid fullscreen scan)
- find a candidate of "Search images with Google Lens" item in the opened menu
- move the mouse to the candidate
- click the candidate
For now the script only works if the contextual menu in Chrome open the right side of the mouse cursor (e.g. when the mouse is not near the right side of the screen). This is because the script naively crop a predefined region on the right side of the cursor to try locate the "Search images with Google Lens" item in the menu.
- crop the screenshot to an even more optimal region (predict the contextual menu location from the mouse location on the screen)
- Delete the need to use
AutoHotKey
and implements a background loop in the script awaiting for the keychords to be pressed;
This project is opened to PR, please feel free to participate if you like the idea behind this project and want to improve it.