Link JabRef File to DevonThink

Hello JabRef-Community,

I just started working with JabRef and while I’m trying to integrate my collected eBooks into JabRef, I have problems linking my files properly. As I couldn’t find any answers on the Forum, I might ask you for help. :slight_smile:
I’m a Mac-User with DevonThink as a my DMS for nearly everything. All my eBooks are stored within a DevonThink Database. If I drag and drop one of my PDFs from my DevonThink GUI into JabRef, it’s going to copy the path of the database in “Finder Structure”.
For Example it will save:

:/Users/Fabniam/Documents/DevonThink/Studium.dtBase2/Files.noindex/pdf/5/Secondary symptoms of dyslexia a comparison of self esteem and anxiety profiles of children with and without dyslexia.pdf:PDF

But as you can see in the path, JabRef copy the Link of the database. If I’m going to reorganise my database or even just renaming the file, this link will be useless. For this purpose DevonThink is able to give out Permanent Links, which are common for use in other Apps like Microsoft OneNote or GTD Software. These links (I don’t know if there is a special name for them, but I saw similar links in other apps, so I’m guessing it’s an macOS feature) look like the following:

x-devonthink-item://3E364AA0-F93D-492D-9D4A-AEC6013612D2

So DevonThink produces an unique Fingerprint for my file and no matter if I rename, move or edit the file, I can access it through this link. Some integrated workflows also use these link, e.g. if I link a file with a wunderlist task:

06

I can click this link or just use it via terminal if I use the open command:

open x-devonthink-item://3E364AA0-F93D-492D-9D4A-AEC6013612D2

Now I want JabRef to use these links instead of these “Finder Structure” links. I don’t mind if I manually need to update these links in my JabRef Library.

Thank you in advance for your help. :slight_smile:

As I don’t have a mac I can’t play around but the following might work:
Go to Help > Preferences > External programs and choose “Manage external file types”. Then you click the plus icon to add a new one, specify a name (like “DevonThink”) and under “Application” choose the second option and write “open” in the text field next to it.

After this set-up, you should be able to add a new file, use the DevonThink link like x-devonthink-item://3E364AA0-F93D-492D-9D4A-AEC6013612D2 as the path and the new “DevonThink” file type. Now hopefully JabRef opens the file if you click the icon in the main table.

Thanks for your advice!

When I try to add a new external file type, I can set the following options:
15
Maybe it’s just on the Mac GUI, but I can’t find a second option unter Application.

My bad, I was using the latest development version which also has an “Default” option there. So in your case, does it work if you add the path to DevonThink (as you have in the screenshot) or simply the command “open” there?

When I try it as in my screenshot JabRef won’t open the file and its status reports: “Unable to open link”.

Same when I replace the path to DevonThink with “open”.
Does anybody know how exactly JabRef opens files. Will it just execute a command via terminal and the file-path is a variable?

JabRef will invoke /usr/bin/open -a <application> <path>. However, before this it checks if the file can be found in the file system. This check fails because the devonthink link is not resolved.

@Siedlerchr can you have a look at this issue as I don’t have a Mac to test it. The code in question is the last else statement in JabRefDesktop, where we should try to call the application directly with the string provided.

    public static boolean openExternalFileAnyFormat(final BibDatabaseContext databaseContext, String link,
            final Optional<ExternalFileType> type) throws IOException {

        if (REMOTE_LINK_PATTERN.matcher(link.toLowerCase(Locale.ROOT)).matches()) {
            openExternalFilePlatformIndependent(type, link);
            return true;
        }

        Optional<Path> file = FileHelper.expandFilename(databaseContext, link, Globals.prefs.getFileDirectoryPreferences());
        if (file.isPresent() && Files.exists(file.get()) && (type.isPresent())) {
            // Open the file:
            String filePath = file.get().toString();
            openExternalFilePlatformIndependent(type, filePath);
            return true;
        } else {
            // No file matched the name, or we did not know the file type.
            return false;
        }
    }

@Fabniam may I ask you to open a feature request at github, where the other developers with a Mac are sitting and just waiting to help you ;-).

I opened a Issue in github:

Thanks for your engage!