Skim deep links stopped jumping to selection after update

Hi there,

I just updated Hook yesterday. Before then, Skim deep links were working. I could click on a copied link in another app (Craft), Skim would come into focus with the pdf, and jump to the selection, and highlight it. But after I updated yesterday, it opens the file, and highlights the selection, but it no longer jumps to it. So if I’m in another part of the document, I have to manually navigate to it.

I tried restarting my M1 MBA and reinstalling Skim, but neither of these worked.

Any help you could offer would be much appreciated!

Similar issue here, except it won’t select the text either, it just opens the PDF.

Hookmark version 4.0.1 (5010) (Scripts version 239), Skim Version 1.6.13 (143)

i think this away it’s right! maybe you can try it !

belated welcome to the Hook Productivity Forum, @trait. and welcome here @dimii . And welcome back, @bishblaize :slight_smile: . Sorry for the delay in responding to this.

Looking at our release notes, I don’t see that we have changed the Skim integration recently. Skim has changed a bit, but I haven’t noticed a difference. So I’m wondering if there’s another issue here. I still can’t reproduce this. See video below.

As a reminder: there’s a difference between deep links formed when one makes a selection in Skim using Skim’s “Select” tool vs. when one uses its “Text” tool. Quoting from Using Hookmark with the Free Skim PDF Reader app: Deep Links! – Hookmark:

However, the within-page coordinates of Hookmark’s deep PDF links in Skim depend partly on the type of Skim selection tool you use (Skim’s Tools menu).

  1. If Skim’s selection tool is set to ‘Select Tool’, then the deep URL will contain the page number, and the x and y coordinates of the selection, like this: #p=4&x=60&y=213.
  2. If Skim’s selection tool is set to ‘Text Tool’, then the deep URL will contain the page number, and search coordinates (start and end) of the selection, like this: #p=4&x=0&y=0&s=2114&e=2271.

In either case, you get the page number, and some offset information. The page number is useful for any compliant PDF app. However, the search coordinates (returned by the Text Tool) can only be used by Skim.

That means that if you use the Text Tool to indicate deep links, Hookmark will only take you to the correct location on the target page if you open that URL in Skim.

For completely interchangeable within-page precision of deep links from Skim, use the Select Tool.

Is it possible that users have been using a different tool in Skim to make a selection?

Can affected users please paste their deep URLs here so we can have a look? But first, please name the PDF document something unique like “259BJ-1YYF2.pdf” so that we can try to reproduce with that file name. Also: good to use the </> quote so that the forum doesn’t transform the URL.

Here’s my experience with links created in 2 different manner:

aka: video in Dropbox here.

so you can see the full links, I copied them as Markdown and pasted them in BBEdit (plain text), using its ‘open url’ to open them.

By the way, our documentation does not mention anything about whether text will be selected. I notice the two types of links are handled differently. After clicking on links of one type, Skim selects it; the other type not. But auto-scroll should work either way. We might clarify the documentation re that.

for the record:

a select tool link: p.1: [Wineburg-1998-Interpretation Abraham Lincoln Texts An Expert Expert Study in the of Historical-Wineburg1998.pdf](hook://file/8dv0VtyWP?p=QnVnemlsbGEgSXNzdWVzIG1pc2MgLSBTeW5jL0lzc3VlIDYzNDUg4oCTIERlZXAgbGlua2luZyBpbiBTa2ltIGlzIGJyb2tlbg==&n=Wineburg%2D1998%2DInterpretation%20Abraham%20Lincoln%20Texts%20An%20Expert%20Expert%20Study%20in%20the%20of%20Historical%2DWineburg1998%2Epdf#p=17&x=55&y=239)

a text tool link: [Wineburg-1998-Interpretation Abraham Lincoln Texts An Expert Expert Study in the of Historical-Wineburg1998.pdf](hook://file/8dv0VtyWP?p=QnVnemlsbGEgSXNzdWVzIG1pc2MgLSBTeW5jL0lzc3VlIDYzNDUg4oCTIERlZXAgbGlua2luZyBpbiBTa2ltIGlzIGJyb2tlbg==&n=Wineburg%2D1998%2DInterpretation%20Abraham%20Lincoln%20Texts%20An%20Expert%20Expert%20Study%20in%20the%20of%20Historical%2DWineburg1998%2Epdf#p=9&x=0&y=0&s=588&e=794)

Sorry for being slow, I had a play with the two different tools. I can see that I get different links created when I switch between them, however neither will open the PDF to the correct location.

hook://file/KY6BCwLje?p=cGRmLzY=&n=27%2E%20Ageism%20in%20cancer%20care%2Epdf#p=3&x=0&y=0&s=3309&e=3331

and

hook://file/KY6BCwLje?p=cGRmLzY=&n=27%2E%20Ageism%20in%20cancer%20care%2Epdf#p=3&x=300&y=470

I can see they have same format as your file names, but Skim just opens to the start of the first page. I’m minded to say its a Skim issue since the link seems right.

Is it possible you overrode/edited Hookmark’s Skim open script?

Definitely says its the default

Script
use scripting additions
use framework "Foundation"

on urlDecode(input)
    tell current application's NSString to set urlString to stringWithString_(input)
    set theDecodedURL to urlString's stringByRemovingPercentEncoding -- 4 is NSUTF8StringEncoding
    return theDecodedURL as Unicode text
end urlDecode

set fullURL to "$0"


set AppleScript's text item delimiters to "#"
set urlPath to text item 1 of fullURL
set selectText to false
if (count of text items of fullURL) is greater than 1 then
    set fragment to text item 2 of fullURL
    set AppleScript's text item delimiters to "&"
    set kvs to text items of fragment
    repeat with kv in kvs
        set AppleScript's text item delimiters to "="
        set k to text item 1 of kv
        set v to text item 2 of kv
        if k = "p" then
            set p to v as number
        end if
        if k = "x" then
            set x to v as integer
        end if
        if k = "y" then
            set y to v as integer
        end if
        if k = "s" then
            set selectText to true
            set s to v as integer
        end if
        if k = "e" then
            set e to v as integer
        end if
    end repeat
end if

set fpath to urlDecode(urlPath)
set text item delimiters to "/"
set fn to text item -1 of fpath
set len to length of fpath
set fpath to text 8 through len of fpath
set targetWindow to missing value


tell application id "net.sourceforge.skim-app.skim"
    activate
    repeat with i from (count of windows) to 1 by -1
        set thisWindow to window i
        set thisDoc to document of thisWindow
        if thisDoc is not missing value and (path of thisDoc) is equal to fpath then
            set targetWindow to thisWindow
            if index of targetWindow is not 1 then
                set index of targetWindow to 1
            end if
            exit repeat
        end if
    end repeat
    
    if targetWindow is missing value then
        open fpath
        set targetWindow to first window
    end if
    
    if p is not missing value then
        
        tell document 1
            set current page to page p
            if selectText then
                set selection to characters s thru e of text of page p
            else
                go to page p at {x, y}
            end if
        end tell
        
    end if
    
end tell

I think I was having the same issue, and what solved it for me was to give Hookmark Full Disk Access. It already had access to my Dropbox folder, and my Documents folder, but it merely opened PDFs, but did not scroll to the page for me, despite the URL seeming to be correct for Hookmark.

After playing around with the URL, changing it to use skim:/// style links (complete with the #page=100 format, rather than “#p=100” as skim uses), and then re-copying the link from Hookmark, it occurred to me that MacOS didn’t give Hookmark the access it needed. With full disk access, Hookmark started taking me to the correct page in Skim.

I didn’t see anyone mention their Mac OS version, so maybe that’s got something to do with it?

Mac OS 13.1, M1 Macbook Pro
Hookmark 4.0.1
Skim 1.6.14

Welcome to the Hook Productivity Forum, @rdale ! Thank you very much for your solution!

Sorry this fell through the cracks.

Could you please try the solution @rdale kindly provided?

If that does not solve your problem, could you please try reinstalling Skim? Some users solved the problem by reinstalling the app.

Thank you

I use Skim daily. In fact, I’m lead author a long paper on wearables and insomnia, with over 130 references so far. I use Skim for all of them.

I did both and it appears to work fine now, many thanks

1 Like

I have the same issue of Skim not opening to the page in the HookMark link. I have checked it is the default script. I have tried reinstalling Skim and giving full disk access to HookMark as well as rebooting the computer. No success. Skim always open the first cover page.
Skim Version 1.6.14 (144)
MacOs: 13.1 (22C65)

Sorry for the trouble.

Does it happen to all PDF documents?

Bi Ling

Unfortunately, yes.
I also tried instructions you provided in another post - downloading your pdf and pasting the link in Safari (without success).
It’s not a big deal for me. I have started using Reader from Readwise to read my PDFs and Hookmark works perfectly there.

Could you please copy a deep link from SKIM and post it here? I just want to check if the link is generated correctly.

Thank you

Firstly, I need to apologize. I use OpenIn, and I thought that disabling pdf handling in OpenIn was enough, then I realized that my OS still had OpenIn as a default app for opening PDFs.
I fixed that. This is the situation at the moment.

  • if Nitro PDF Pro is set as the default app, deep links work
  • If Skim is set the default app, HookMark links without page coordinates will open the document in Skim BUT links with page coordinates will launch Skim but without any windows (the pdf is not opened).
    this is the link generated:
    [looking for calvin and hobbes_ the unconventional story of bill watterson and his revolutionary comic strip (2010).pdf](hook://file/KNzfFS9Wu?p=c2VyZ2VmYXNzaW4vRG93bmxvYWRz&n=looking%20for%20calvin%20and%20hobbes%5F%20the%20unconventional%20story%20of%20bill%20watterson%20and%20his%20revolutionary%20comic%20strip%20%282010%29%2Epdf#p=13&x=0&y=0&s=1621&e=1674)
    I have tried reinstalling Skim (again) and the two selection methods.
    I take back what I said in my previous post, Skim is my app of choice for PDF.

Thank you for the info, @roginissaf .

I can’t reproduce it on my mac. Could you please help us debug by following these steps:
(1)Open /Applications/Utilities/Script Editor
(2) Copy the script below and paste in Script Editor
(3)At line 9 of the script, change the username to your user name
(4)Put the pdf file in your Downloads folder: looking for calvin and hobbes_ the unconventional story of bill watterson and his revolutionary comic strip (2010).pdf
(5)Run the script
(6)If there is any error message, please post it here. Also, in Script Editor, on the horizontal divider, click on Replies, copy all the text and post in the forum(take out private info if there is any).

Thank you

Summary
use scripting additions
use framework "Foundation"
on urlDecode(input)
	tell current application's NSString to set urlString to stringWithString_(input)
	set theDecodedURL to urlString's stringByRemovingPercentEncoding -- 4 is NSUTF8StringEncoding
	return theDecodedURL as Unicode text
end urlDecode
--change the username to your user name
set YOUR_USER_NAME to "username"

set fullURL to "file:///Users/" & YOUR_USER_NAME & "/Downloads/looking%20for%20calvin%20and%20hobbes_%20the%20unconventional%20story%20of%20bill%20watterson%20and%20his%20revolutionary%20comic%20strip%20(2010).pdf#p=13&x=0&y=0&s=1621&e=1674"


set AppleScript's text item delimiters to "#"
set urlPath to text item 1 of fullURL
set selectText to false
if (count of text items of fullURL) is greater than 1 then
	set fragment to text item 2 of fullURL
	set AppleScript's text item delimiters to "&"
	set kvs to text items of fragment
	repeat with kv in kvs
		set AppleScript's text item delimiters to "="
		set k to text item 1 of kv
		set v to text item 2 of kv
		if k = "p" then
			set p to v as number
		end if
		if k = "x" then
			set x to v as integer
		end if
		if k = "y" then
			set y to v as integer
		end if
		if k = "s" then
			set selectText to true
			set s to v as integer
		end if
		if k = "e" then
			set e to v as integer
		end if
	end repeat
end if

set fpath to urlDecode(urlPath)
set text item delimiters to "/"
set fn to text item -1 of fpath
set len to length of fpath
set fpath to text 8 through len of fpath
set targetWindow to missing value


tell application id "net.sourceforge.skim-app.skim"
	activate
	repeat with i from (count of windows) to 1 by -1
		set thisWindow to window i
		set thisDoc to document of thisWindow
		if thisDoc is not missing value and (path of thisDoc) is equal to fpath then
			set targetWindow to thisWindow
			if index of targetWindow is not 1 then
				set index of targetWindow to 1
			end if
			exit repeat
		end if
	end repeat
	
	if targetWindow is missing value then
		open fpath
		set targetWindow to first window
	end if
	
	if p is not missing value then
		
		tell document 1
			set current page to page p
			if selectText then
				set selection to characters s thru e of text of page p
			else
				go to page p at {x, y}
			end if
		end tell
		
	end if
	
end tell

Thank you very much for your help in this matter.
The script does not generate any errors. Skim opens the PDF at the right page.
I do not know if the following information is at all useful to you:
Using Safari to open the following URL:

<file:///Users/sergefassin/Downloads/looking%20for%20calvin%20and%20hobbes_%20the%20unconventional%20story%20of%20bill%20watterson%20and%20his%20revolutionary%20comic%20strip%20(2010).pdf#p=13&x=0&y=0&s=1621&e=1674>

this opens the PDF (obviously not at the right page)

<hook://file/KNzfFS9Wu?p=c2VyZ2VmYXNzaW4vRG93bmxvYWRz&n=looking%20for%20calvin%20and%20hobbes%5F%20the%20unconventional%20story%20of%20bill%20watterson%20and%20his%20revolutionary%20comic%20strip%20%282010%29%2Epdf#p=13&x=0&y=0&s=1621&e=1672>

Launches Skim but does not open the PDF