I made a code that automatically opens one pdf file at a time with the help of the FineReader.exe program
yes, the file opens, but the key combination does not work in the code (although it works perfectly from the keyboard). is there something wrong with my code?
this is the key combination i want to use:
"Ctr+Shift+S" (open File from the FineaReader menu)
"Alt+T" (tab the transition to the combo in which the file extensions)
"T" (Choose to save in Text format)
"Enter" (Save actually)
This is my Python code:
import os
import subprocess
import time
import pyautogui
# Directorul cu fisierele PDF
pdf_dir = r'g:\1\2'
# Calea catre executabilul ABBYY FineReader
abbyy_path = r'"c:\Program Files (x86)\ABBYY FineReader 15\FineReader.exe"'
# Obtine o lista cu toate fisierele PDF din director
pdf_files = [f for f in os.listdir(pdf_dir) if f.endswith('.pdf')]
pdf_files.sort() # Sorteaza lista de fisiere
# Deschide fiecare fisier PDF cu ABBYY FineReader
for pdf_file in pdf_files:
pdf_path = os.path.join(pdf_dir, pdf_file)
# Adauga ghilimele in jurul caii fisierului
subprocess.run(abbyy_path + ' "' + pdf_path + '"', shell=True)
# Asteapta ca ABBYY sa proceseze fisierul
time.sleep(10)
# 1. Trimite combinația de taste 'Ctrl+Shift+S' pentru a deschide meniul 'Save As'
pyautogui.hotkey('ctrl', 'shift', 's')
time.sleep(1)
# 2. Trimite tasta Alt și tasta 't' pentru a accesa meniul de tipuri de fișiere
pyautogui.hotkey('alt', 't')
time.sleep(1)
# 3. Trimite tasta 't' pentru a selecta 'Txt document'
pyautogui.press('t')
time.sleep(1)
# 4. Trimite tasta Enter pentru a confirma
pyautogui.press('enter')
time.sleep(1)
# Așteaptă un moment pentru a te asigura că fișierul a fost salvat
time.sleep(5)
# Închide ABBYY înainte de a continua cu următorul fișier
pyautogui.hotkey('alt', 'f4')
time.sleep(1)
I made a code that automatically opens one pdf file at a time with the help of the FineReader.exe program
yes, the file opens, but the key combination does not work in the code (although it works perfectly from the keyboard). is there something wrong with my code?
this is the key combination i want to use:
This is my Python code: