Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fightforthefutu

macrumors newbie
Original poster
Nov 12, 2014
7
0
Greetings,

I have a tiresome task of renaming hundreds of bookmarks in nearly fifty pdf books. An applescript seems like the best solution, but my scripting has not produced results. I'm using OSX 10.8.5 on a Mac mini.

Code:
tell application "Adobe Acrobat Pro"
	try
		set (every text of every bookmark of document 1 whose it = "560-VAA") to "EPCA_April_14"
	end try
end tell

What's going wrong with it?

I know the script can handle bookmarks. A script I found online works well when deleting them.

Code:
tell application "Adobe Acrobat Pro"
    delete bookmarks of document 1
end tell

A slight modification to the first script resulted in bizarre consequences:

Code:
tell application "Adobe Acrobat Pro"
	
	set name of every bookmark to text
	try
		set (text where it is "560-AAA") to "EPCA_April_14"
	end try
end tell

The consequence with this is, all of the hundreds of bookmarks are renamed "ctxt". So that's not progress, but its generally in the right direction! Any further observations or aid would be greatly appreciated. Thanks!
 
Last edited:
Still stuck on renaming bookmarks

Hello, hope everyone had a good weekend!

I'm back to playing with an applescript to rename bookmarks. After Friday's effort, I discovered that the line "set name of every bookmark to text" gave me "ctxt" because that is the literal name for "text". Interesting. Unhelpful, but interesting.

Now I have been able to rename bookmarks based on their ordered number. So,

Code:
tell application "Adobe Acrobat Pro"
	try
	set (name of bookmark 1) to "Cover"
		set (name of bookmark 2) to "Title Page, Copyright"
	end try
end tell


This syntax is not particularly helpful as some books have more bookmarks than others. It would be much better to change the names of the bookmarks themselves. So, I finally put together the right combination of little words, and Presto!

Code:
tell application "Adobe Acrobat Pro"
	try
		set name of every bookmark whose name contains "0001-AAA" to "Cover"
		set name of every bookmark whose name contains "0002-AAA" to "Title Page, Copyright"
		set name of every bookmark whose name contains "0003-AAA" to "Index"
	end try
end tell

Yes, its all childishly simple. But then, I'm a kid at heart, and a programmer I'm not.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.