I modified the script. Could you please give it a try, for a highlighted annotation?
Summary
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
try
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
try
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 & ")"
else
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
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.