Sign in to follow this  
Followers 0
Albertxu

How to rename 2400+ PDFs with AutoIt based on its Title?

7 posts in this topic

#1 ·  Posted (edited)

Hi, my hard disk met with some problems and all partitions missing and so as files. I do recover large part of my docs after using Easy Recovery, but the recovered files are all in a mess --they are renamed with such names as FIL0, FIL99 etc.

My question is: how can I read the titles from within the PDF document and then rename the files with title using AutoIt. I know that some of them have blank titles but at leat 60% of them have. For those who don't understand the title of the PDFs, you can just find it out as you click in Adobe Acrobat menus -File-> Property, there you can see the title along with the author.

Can someone help me?

Edited by Albertxu

Share this post


Link to post
Share on other sites



Hi Albertxu,

you can open the PDF with FileOpen or _FileReadToArray and look for the strings /Author and /Title.

This should give you the information requested.

:huh2:


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I can't find it at the moment but there seems to be an example script that lists all attibutes of a file (those that you can select as columns for the Windows Explorer).

Edit: Got it! Try or to extract all file properties.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I can't find it at the moment but there seems to be an example script that lists all attibutes of a file (those that you can select as columns for the Windows Explorer).

Edit: Got it! Try or to extract all file properties.

I'm not sure if there's Metadata ready for PDF files. On my XP I cannot see it in Windows Explorer. Maybe under Win Vista or 7. I think looking at the text of the file will be the easier method here.

:huh2:


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Just tried it on W7 and - unfortunately - you are right! :huh2:

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi,

because you have Adobe Acrobat you can control it via IAC (activeX)

You may use the attached script.

HTH, Reinhard

$FilePath = "C:\Test.pdf"
;;----------------------
$App = ObjCreate("AcroExch.App")       ;; start Adobe Acrobat
$App.Show                              ;; show Acrobat or comment out for hidden mode
$AVDoc = ObjCreate("AcroExch.AVDoc")   ;; connect to Ac Viewer
If $AVDoc.Open($FilePath,"") Then      ;; open the file
    $title = $avDoc.getTitle       ;; get the title      
    MsgBox(0,"",$title)
endif
$app.exit()                            ;; close process
;; release objects
$AvDoc = 0
$App = 0

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0