Adobe Acrobat cannot get deep links

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.

Welcome to Hookmark forum, @Cryptohkk .

Could you please try turning on “Full disk access” for Hookmark and see if it fixes the problem?

Thank you

Thank you for your reply. Indeed, I didn’t turn on “Full disk access” for hookmark; however, the hookmark still didn’t work even after turning it on.

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.

Thank you

[Book]_Protocols for Authentication and Key Establishment.pdf

hook://file/YfIK9OXy8?p=UGhEL1BoRF9Cb29rc19MaWJyYXJ5&n=%5BBook%5D%5FProtocols%20for%20Authentication%20and%20Key%20Establishment%2Epdf#p=412&x=271.346984863281&y=275.489013671875

Thank you, @Cryptohkk .

The link looks good. If you paste the link somewhere, when you click on it, does it take you to page 412?

Yes, I can go to page 420 by clicking the link; :sweat_smile: I think I misunderstood the concept of “deep link”.

And, “Copy Selection and Link” is available in Skim.

Thank you for your reply and help!

Yes. Hookmark is able to get the selection text from Skim.

Thank you

I’m facing the same problem, but the advice you shared doesn’t work for me. Is there another solution to fix this issue? Thanks in advance.

  • Hookmark: Version 6.0.1 (5788; Integration v. 310)
  • Adobe Acrobat Pro: Version 2023.008.20458
  • macOS: Sonoma 14.2.1

Here is an example of a copy link below:

[Urmson. 2023. Saints and Heroes.pdf] (hook://file/YO4PJCvln?p=TWVuZGVsZXkgTGlicmFyeS9Vcm1zb24=&n=Urmson%2E%202023%2E%20Saints%20and%20Heroes%2Epdf)

Welcome to Hookmark forum, @eutrapelos .

Just want to be sure, did you select some text before you invoke the Hookmark window? Do all files have this problem?

Thank you

Thank you for your prompt reply.
Yes, I tried doing it several times like below, but the results were the same:

Link-screen-recording

Thank you for the video file!

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?

Sorry about this.

We will have a look.

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”

[OR]
“/Users/jeong-joolee/Desktop/conversation-analysis.pdf”

Thank you for your support!

Thank you!

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

Thank you for your message! Here are the details you requested:

  • [First message in the box] 5 step 00
  • [Second] The variable firstBounds is not defined.step 1
  • [Third] step 0000
  • [Fourth] Can’t get mutableCopy of URLQueryAllowedCharacterSet of NSMutableCharacterSet.step 2

As a result:

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

Thank you!

Is the above result from a highlighted annotation?