Adobe Acrobat cannot get deep links

Sorry! The highlighted annotation way yields slightly different results, as shown below:

[First] 5 step 00
[Second] step 000
[Third] Can’t get mutableCopy of URLQueryAllowedCharacterSet of NSMutableCharacterSet.step 2

“/Users/jeong-joolee/Library/CloudStorage/Dropbox/Mendeley Library/Rosati/Rosati. 2016. Moral Motivation.pdf”

Thank you!

I modified the script. Could you please give it a try, for a highlighted annotation?

use framework "Foundation"
use scripting additions

property NSMutableCharacterSet : a reference to current application's NSMutableCharacterSet

on urlEncode(input)
	tell current application's NSString to set rawUrl to stringWithString_(input)
	set charset to NSMutableCharacterSet's URLQueryAllowedCharacterSet's mutableCopyWithZone:(missing value)
	charset's removeCharactersInString:"?"
	set theEncodedURL to rawUrl's stringByAddingPercentEncodingWithAllowedCharacters:charset
	return theEncodedURL as Unicode text
end urlEncode
	set hasAnnotation to false
	tell application "Adobe Acrobat"
		set ver to version
		if ver is less than "2021" then
			set currentFilePath to (file alias of active doc)
			return POSIX path of currentFilePath
		end if
		set currentFilePath to (file alias of active doc)
		set t to name of active doc
		set docPath to POSIX path of currentFilePath
			tell PDF Window 1
				set pn to page number
				set firstBounds to bounds of annotation 1 of page pn
				set xx to third item of firstBounds
				set yy to fourth item of firstBounds
				set hasAnnotation to true
			end tell
		on error errStr number errorNumber
		end try
	end tell
	if hasAnnotation then
		get "[" & t & " - " & pn & "](file://" & urlEncode(docPath) & "#p=" & pn & "&x=" & xx & "&y=" & yy & ")"
		get "[" & t & "](file://" & urlEncode(docPath) & ")"
	end if
on error errStr number errorNumber
	tell application "Adobe Acrobat"
		set currentFilePath to (file alias of active doc)
		POSIX path of currentFilePath
	end tell
end try

It appears to be functioning! Here is the result:

“[Urmson. 2023. Saints and Heroes.pdf - 5](file:///Users/jeongjoolee/Library/CloudStorage/Dropbox/Mendeley%20Library/Urmson/Urmson.%202023.%20Saints%20and%20Heroes.pdf#p=5&x=189,327285766602&y=429,485626220703)”

Thank you!

I just updated our script server, version 311.

If you have modified your script, could you please click on “Reset to default” button? Then you can update your script(Hookmark preferences window->Update->Check Now).

You might need to restart your Hookmark. Normally, you don’t have to.

It’s working perfectly now.
Thank you very much for your help!! :slight_smile:

Thank you for letting me know! I am glad it works.

Thank you for all your patiences and help! I really appreciate it.

Have a good weekend!