Jump to content

Recommended Posts

Posted

Application: Adobe Reader 10.0.1

I need to save multiple PDF files to text files. All the PDF files are reside in c:\data folder.

Qn: 1) The script below is saving only one PDF file to text file.

How do I save mulitple PDF file using While loop?

this is my script:

;

; Runs Adobe Reader version 10.0.1

;

;Runs PDF Application

ShellExecute ("AcroRd32.exe")

;WinExists("Adobe Reader")

; Wait for Adobe Reader to become active

WinWaitActive("Adobe Reader","","")

Sleep(1000)

; Open File

Send("^o") ;File Open using Control o

Send("!n") ;Set cursor on File name path

Sleep(500) ;Wait for 0.5 sec

Send("C:\Data\outfile1") ;Enter outfile1.pdf full directory path

Sleep(1000)

Send("!o") ;Open outfile1.pdf

; Wait for Adobe Reader to become active

WinWaitActive("outfile1.pdf - Adobe Reader","","")

Send("!f") ;File Open

Send("a") ;Save As

Send("x") ;Text

; Wait for Save As Window to become active

WinWaitActive("Save As","","")

Send("!s") ;Save

; Wait for Adobe Reader to become active

WinWaitActive("outfile1.pdf - Adobe Reader","","")

Send("^q") ;Close Adobe Reader

;Wait for the window to not exist

WinWaitClose("outfile1.pdf - Adobe Reader","","")

Posted

Check WHILE and WEND commands.

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Posted

Hi lisehu,

you can use ShellExecute() to open a PDF file directly.( Shellexecute("C:\data\outfile1.pdf") )

Use FileFindFirstFile, FileFindNextFile OR _FileListToArray to have a list of pdf file ready.

As November already said, you'll need loops (WHILE ... WEND, FOR ... NEXT) to open all of the documents in one script. :unsure:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted

Hi Hannes,

I'm not too good at scrpting. Can you teach me how to do it?

Thanks!

Lisehu

Hi lisehu,

you can use ShellExecute() to open a PDF file directly.( Shellexecute("C:\data\outfile1.pdf") )

Use FileFindFirstFile, FileFindNextFile OR _FileListToArray to have a list of pdf file ready.

As November already said, you'll need loops (WHILE ... WEND, FOR ... NEXT) to open all of the documents in one script. :unsure:

Posted

$a_pdflist = _FileListToArray("C:\Data", "*.pdf")

For $i = 1 To $a_pdflist[0]
    ShellExecute("C:\Data\" & $a_pdflist[$i])
    WinWaitActive($a_pdflist[$i] & " - Adobe Reader") 

    Send("!f") ;File Open
    Send("a") ;Save As
    Send("x") ;Text

    ; Wait for Save As Window to become active 
    WinWaitActive("Save As","","") 
    Send("!s") ;Save

    ; Wait for Adobe Reader to become active 
    WinWaitActive("outfile1.pdf - Adobe Reader","","") 
    Send("^q") ;Close Adobe Reader

    ;Wait for the window to not exist
    WinWaitClose("outfile1.pdf - Adobe Reader","","") 
Next

:unsure:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted

Works perfectly. Thank you very much, Hannes!

:unsure:

$a_pdflist = _FileListToArray("C:\Data", "*.pdf")

For $i = 1 To $a_pdflist[0]
    ShellExecute("C:\Data\" & $a_pdflist[$i])
    WinWaitActive($a_pdflist[$i] & " - Adobe Reader") 

    Send("!f") ;File Open
    Send("a") ;Save As
    Send("x") ;Text

    ; Wait for Save As Window to become active 
    WinWaitActive("Save As","","") 
    Send("!s") ;Save

    ; Wait for Adobe Reader to become active 
    WinWaitActive("outfile1.pdf - Adobe Reader","","") 
    Send("^q") ;Close Adobe Reader

    ;Wait for the window to not exist
    WinWaitClose("outfile1.pdf - Adobe Reader","","") 
Next

:>

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
×
×
  • Create New...