Bypassing Abbyy FineReader's monthly limit with a clickbot
As researchers, we often hit unexpected roadblocks in the tools we use daily. Abbyy FineReader, a popular Optical Character Recognition (OCR) software, restricts automatic processing of text documents to 5,000 pages per month. While this limit might be sufficient for casual users, it can be restrictive for large-scale projects. In this post, I’ll share a simple Python script leveraging the pyautogui
library to automate the GUI interactions with Abbyy FineReader, potentially allowing you to process more than the set limit.
How it Works:
The script uses pyautogui
to mimic human interactions with the Abbyy FineReader software. This means it moves the mouse, clicks on specified coordinates, and even types out paths and filenames. Essentially, it automates the entire process of:
- Opening files from specified directories.
- Running the OCR process on them.
- Saving the results in both PDF and HTML formats.
Using the Script:
- Setup: Define your directory paths and specify the screen dimensions if they differ from the defaults in the script.
- Run: Execute the script. Ensure Abbyy FineReader is not open to start. Once started, don't interrupt or use the computer, as the script will take control of your mouse and keyboard.
- Output: Processed files will be saved in the specified formats.
Customization:
Feel free to modify the coordinates based on your screen resolution or if the layout of your Abbyy FineReader differs from mine. You can use tools like the position tracker in pyautogui to identify exact screen coordinates.
Caveats:
- This script is sensitive to screen resolution and software layout. Changes in either might necessitate adjustments in the script.
- For consistent results, always run the script in the same environment, preferably without other apps running in the background.
Disclaimer: This script is intended for personal use, to help automate repetitive tasks. Make sure you are not violating Abbyy FineReader’s terms of service or any other applicable laws or agreements by using or modifying this script.
import pyautogui
import pygetwindow
import time
import os
currentMouseX, currentMouseY = pyautogui.position()
print("X Cordinate is: ", currentMouseX)
print("Y Cordinate is: ", currentMouseY)
screenwidth, screenheight = pyautogui.size()
screenwidth1 = 1280
screenheight1 = 712
savetime = 1
ocrtime = 2
path = "path/to/your/folder"
dir_list = [directory for directory in os.listdir(path) if os.path.isdir(path+directory) and not "files" in directory]
folders = dir_list
time.sleep(2)
pyautogui.moveTo(23/screenwidth1*screenwidth,693/screenheight1*screenheight)
pyautogui.click(23/screenwidth1*screenwidth,693/screenheight1*screenheight,duration=1)
time.sleep(2)
pyautogui.write('Abbyy FineReader 15')
time.sleep(5)
pyautogui.press('Enter')
time.sleep(20)
# for loop
for folder in folders:
# Open new files
time.sleep(5)
pyautogui.moveTo(212,71)
pyautogui.click(212,71,duration=1)
# Enter path to folder
time.sleep(5)
pyautogui.moveTo(395, 80)
pyautogui.click(395, 80, duration=1)
pyautogui.write(path+folder)
pyautogui.press('Enter')
# Select all files in folder
time.sleep(5)
pyautogui.moveTo(318,258)
pyautogui.click(318,258,duration=1)
pyautogui.hotkey('ctrl', 'a')
# Click open
time.sleep(5)
pyautogui.moveTo(488,582)
pyautogui.click(488,582,duration=1)
time.sleep(60*ocrtime)
# Click close
time.sleep(5)
pyautogui.moveTo(847,399)
pyautogui.click(847,399,duration=1)
# Click save as
time.sleep(5)
pyautogui.moveTo(935,78)
pyautogui.click(935,78,duration=1)
# Select pdf
time.sleep(5)
pyautogui.moveTo(944,107)
pyautogui.click(944,107,duration=1)
# Write filename
time.sleep(5)
pyautogui.write(folder+".pdf")
# Click save
time.sleep(5)
pyautogui.moveTo(473,535)
pyautogui.click(473,535,duration=1)
time.sleep(60*savetime)
# Click save as
time.sleep(5)
pyautogui.moveTo(935,78)
pyautogui.click(935,78, duration=1)
# Select html
time.sleep(5)
pyautogui.moveTo(944, 202)
pyautogui.click(944, 202, duration=1)
# Enter filename
time.sleep(5)
pyautogui.write(folder + ".html")
# Click save
time.sleep(5)
pyautogui.moveTo(473,535)
pyautogui.click(473,535, duration=1)
time.sleep(60 * savetime)
# Open new project
time.sleep(5)
pyautogui.moveTo(128,70)
pyautogui.click(128,70,duration=1)
# Do not save the old project
time.sleep(5)
pyautogui.moveTo(720,422)
pyautogui.click(720,422,duration=1)
time.sleep(5)
Comments You need to have a GitHub Account to comment!
Post comment