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