Jump to content

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


Recommended Posts

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
Link to comment
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]
Link to comment
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.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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]
Link to comment
Share on other sites

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

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

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