Oct-09-2017, 01:07 PM
Hi All,
I need to open PDF file with Adobe Reader and save to text file using sendkeys:
- File : ALT+F
- Save to Others : H
- Text : X
This is my code to open the file and sendkeys:
import win32com.client
import os
from sys import argv
shell = win32com.client.Dispatch("WScript.Shell")
filename = "C:\RATNA\temp\TU1-2.pdf"
os.chdir('C:\\RATNA\\temp')
os.system('"C:\\Program Files (x86)\\Adobe\\Reader 11.0\\Reader\\AcroRd32.exe" TU1-2.pdf' )
shell.AppActivate('Acrobat.exe')
shell.SendKeys("%{f}",0)
shell.SendKeys("H", 0)
shell.SendKeys("X", 0)
The problem with this code is the sendkeys will be triggered only after I closed the PDF file.
Thank You
I need to open PDF file with Adobe Reader and save to text file using sendkeys:
- File : ALT+F
- Save to Others : H
- Text : X
This is my code to open the file and sendkeys:
import win32com.client
import os
from sys import argv
shell = win32com.client.Dispatch("WScript.Shell")
filename = "C:\RATNA\temp\TU1-2.pdf"
os.chdir('C:\\RATNA\\temp')
os.system('"C:\\Program Files (x86)\\Adobe\\Reader 11.0\\Reader\\AcroRd32.exe" TU1-2.pdf' )
shell.AppActivate('Acrobat.exe')
shell.SendKeys("%{f}",0)
shell.SendKeys("H", 0)
shell.SendKeys("X", 0)
The problem with this code is the sendkeys will be triggered only after I closed the PDF file.
Thank You