Jump to content

Open a file in Adobe Reader - select all text - copy in clipboard - paste in Notepad


Recommended Posts

Posted

Dear sirs,

I am a very novice to autoit3 (downloaded 24 hours).

I would appreciate for any help, I would like to do the following:

1. I have opened "Adobe Reader" and "Notepad" on my desktop (before autoit macro)

2. Set focus to "Adobe Reader" window - I think _WinWaitActivate("Adobe Reader","")

3. Open "document.pdf" on "Adobe Reader" - I do not know how

4. Press "Ctrl+A" to select all text of "document.pdf" - I think Send("{CTRLDOWN}a{CTRLUP}")

5. Press "Ctrl+C" to copy all text to clipboard - I think Send("{CTRLDOWN}c{CTRLUP}")

6. Close "document.pdf" from "Adobe Reader" - I think press "Alt+f+c" Send("{ALTDOWN}f{ALTUP}c")

7. Set focus to "Notepad" window - I think _WinWaitActivate("Untitled - Notepad","")

8. Press "Ctrl+v" to paste all text from clipboard - I think Send("{CTRLDOWN}v{CTRLUP}")

9. Save text to "document.txt" - I do not know how

The final (incomplete) script follows:

_WinWaitActivate("Adobe Reader","")

....

Send("{CTRLDOWN}a{CTRLUP}")

Send("{CTRLDOWN}c{CTRLUP}")

Send("{ALTDOWN}f{ALTUP}c")

_WinWaitActivate("Untitled - Notepad","")

Send("{CTRLDOWN}v{CTRLUP}")

....

Please, help me to finalize the script!

Thank you in advance for your time reading my message.

Best Regards,

Theodore

Posted

You're over complicating this process I think. First, you can open a PDF with ShellExecute, if Adobe Reader is the program that will normally open a PDF if you double click on it, then ShellExecute will run Reader for you. Second, every version of Adobe Reader for the past several years allows you to save a PDF as a text document, look in the File menu. It will default to a text file with the same name as the PDF file just a different extension.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

You're over complicating this process I think. First, you can open a PDF with ShellExecute, if Adobe Reader is the program that will normally open a PDF if you double click on it, then ShellExecute will run Reader for you. Second, every version of Adobe Reader for the past several years allows you to save a PDF as a text document, look in the File menu. It will default to a text file with the same name as the PDF file just a different extension.

Due to problems with "save as text" in reader (saving greek utf-8 text) I am trying to simulate what I am actually doing every day.

Select all text in a (greek) pdf document - copy it to the clipboard - and finally activate Notepad, pasting it there and saving it (in Notepad) as a txt (ANSI) file.

Regards,

Theodore

Posted

There is no _WinWaitActivate command, I'm pretty sure. There is however a WinWaitActive command, but I think this is the command you're thinking of here, WinActivate. The caret '^' will replace {CTRLDOWN}{CTRLUP}, and the exclamation mark '!' will replace {ALTDOWN}{ALTUP}. ClipPut and ClipGet are the equivalent of the clipboard copy and paste commands.

Welcome to the Forum. Good luck!

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...