[Acrobat8] Need help on Bookmark text encoding issue

My simple insert bookmark applescript is as follows:-

tell application "Adobe Acrobat 8.0 Professional"
	activate
	tell document 1
		delete bookmarks
		make new bookmark at end with properties {name:"Fermín Vázquez", destination page number:{1}, fit type:fit page}
	end tell
end tell

As seen, the chapter title should be “Fermín Vázquez” (with extended characters). However, the result has changed to “Fermâ„¢n V⁄zquez”.

It is allright if I insert the bookmark manually. Could not figure out how to overcome this issue. Please advise, thanks!

I still awaiting for some advice on this issue. Thanks!

Btw, I thought of calling a js command to perform the task hoping that js could be able to solve the issue. I replace the line make new bookmark at end with properties {name:“Fermín Vázquez”, destination page number:{1}, fit type:fit page} to do javascript “this.bookmarkRoot.createChild("“Fermín Vázquez"”,"“this.pageNum = 0"”,0);” as shown below:

tell application "Adobe Acrobat 8.0 Professional"
	activate
	tell document 1
		delete bookmarks
		--make new bookmark at end with properties {name:"Fermín Vázquez", destination page number:{1}, fit type:fit page}
		do javascript "this.bookmarkRoot.createChild(\""Fermín Vázquez\"",\""this.pageNum = 0\"",0);"
	end tell
end tell

But I keep on getting a syntax error message from the Script Editor:

Could someone please help me on where have I gone wrong? Thanks!

I don’t have Adobe so I cannot help with you with the script.
I can help you with the error.
You are getting the error because you have quotes within quotes. You have used "" to exit one quote but not the second one.

try this:

do JavaScript "this.bookmarkRoot.createChild(\"\"Fermín Vázquez\"\",\"\"this.pageNum = 0\"\",0);"

I don’t have Acrobat 8 so thing may have changed since my version 7. In this it does NOT like your ‘delete bookmarks’ command nor the location for make new command Im NOT sure why just yet. I do get the same problem with the characters though when I use this:

tell application "Adobe Acrobat 7.0 Professional"
	activate
	tell document 1
		-- delete bookmarks
		make new bookmark with properties {name:"Fermín Vázquez", destination page number:1, fit type:fit page}
	end tell
end tell

The easier way when using JavaScript with Applescript is to wrap your JavaScript strings using ‘single’ quotes then they don’t require escaping from the AppleScript point of view. JavaScript is happy to take either just as long as the enclosing pairs match. This did work for me:

tell application "Adobe Acrobat 7.0 Professional"
	activate
	tell document 1
		-- delete bookmarks
		-- make new bookmark at end with properties {name:"Fermín Vázquez", destination page number:{1}, fit type:fit page}
		do script "this.bookmarkRoot.createChild('Fermín Vázquez', this.pageNum = 0, 0);"
	end tell
end tell

Hi Chris2,

Thanks for your reply. However, I still having the same error with the line above.

Hi Mark67,

Thanks for your help. This script works great (even with Acrobat 8)! And its true that js can handle extended characters better than as(?).

Btw, may I know why it can work with only do script instead of do javascript as I found from most of posts?

Thanks again!

I was NOT sure if ‘do script’ had been a change to ‘do javascript’ between our versions. For me ‘javascript’ is NOT a term of the application and does NOT compile. Don’t know where you found your reference?