Hi, guys, I’m new to Hookmark. I’m using Adobe Acrobat with hookmark, but hookmark can’t get the deep links of pdf in Adobe Acrobat, and the option [copy selection and link] is grayed out.
The software version:
Hookmark 6.0.1 (5788; Integration v. 302);
Adobe Acrobat Pro 2023.003.20244
And Acrobat configuration is not available in scripts.
I guess the reason is that the hookmark doesn’t detect Acrobat, and there is no corresponding configuration in the scripts; after I selected “only show installed apps”, the installed Acrobat can’t be found, but all other apps are available.
Could you please select some text and do “Copy Link”? Then paste the link here.
Currently it supports deep link but not “Copy Selection and Link” because Hookmark can’t get the selected text. We will take another look to see if there is a way to achieve that.
Could you please annotate the selected text first (e.g., highlight) and then invoke Hookmark window? Sorry I forgot about this. For Adobe Acrobat PRO, Hookmark only works with annotated text, not selected text.
Thank you for your advice! I also tried to use the annotation approach, as shown in the video link I shared earlier around the 30-second mark. Unfortunately, it didn’t work as well. Is there something I might be overlooking?
Some times reinstall the App might solve the problem.
Also could you please run the following script in Script Editor and post the result here?
script
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 mutableCopy
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
display dialog errStr & "step 1"
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
display dialog errStr & "step 2"
tell application "Adobe Acrobat"
set currentFilePath to (file alias of active doc)
POSIX path of currentFilePath
end tell
end try
I tried reinstalling the app, but it didn’t fix the issue.
I have shared the results of following the script you provided earlier:
[When Adobe Acrobat Pro app is not opened,] error “The variable currentFilePath is not defined.” number -2753 from “currentFilePath”
[When Adobe Acrobat Pro app is opened, e.g.,]
“/Users/jeong-joolee/Library/CloudStorage/Dropbox/Mendeley Library/Rosati/Rosati. 2016. Moral Motivation.pdf”
I have modified the script. Could you please run it in Script Editor and post all the output here, including the message in the dialog boxes?
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 mutableCopy
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
display dialog ver & "step 0"
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
display dialog (pn as text) & " step 00"
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
display dialog errStr & "step 1"
end try
end tell
if hasAnnotation then
display dialog "step 000"
get "[" & t & " - " & pn & "](file://" & urlEncode(docPath) & "#p=" & pn & "&x=" & xx & "&y=" & yy & ")"
else
display dialog "step 0000"
get "[" & t & "](file://" & urlEncode(docPath) & ")"
end if
on error errStr number errorNumber
display dialog errStr & "step 2"
tell application "Adobe Acrobat"
set currentFilePath to (file alias of active doc)
POSIX path of currentFilePath
end tell
end try