I’ve seen some interest in PDF Expert integration. Here’s my script to integrate — ideally PDF Expert would add AppleScript support.
I don’t use PDF Expert myself and haven’t done much testing, so do let me know if this does what you want.
Get Name
tell application "System Events"
get name of first window of process "PDF Expert"
end tell
Get Address
tell application "System Events"
tell process "PDF Expert"
if enabled of menu item "Show in Finder" of menu 1 of menu bar item "File" of menu bar 1 then
click menu item "Show in Finder" of menu 1 of menu bar item "File" of menu bar 1
delay 0.1
tell application "Finder"
set theItems to selection
set ext to name extension of item 1 of theItems
if ext = "hook" or ext = "HOOK" then
set filepath to item 1 of theItems as alias
return read POSIX path of filepath
end if
set theURL to URL of item 1 of theItems
close front window
activate application "PDF Expert"
get theURL
end tell
end if
end tell
end tell
Hi guys. Complete newbie here. I had a quick read of the Integrations instructions but I’m clearly missing a key point. I’m unsure as to where / how you are supposed to actually save these script files to invoke them in Hook. This PDF Expert one is bang on for what I need so thanks @stevelw for creating this.
Would you have the patience in explaining how / where I have to save the script(s)? Thanks in advance for your help.
I am trying to use PDF Expert with Hook and used the script suggested by stevelw to do so. The script works in a fashion, but it only links files to PDF Expert the application, not to any target file within PDF Expert. So, if I try to link a Word file to a PDF Expert file, all I get is a link to whatever file happens to be currently open in PDF Expert. Thus, if I create a link to a file open in PDF Expert but then close that file and open another file, the latter is what my Word file will then be linked to. I am hoping the script can be modified to accomplish what I want, but I don’t know how to do it.
I must have made some error when I originally entered the script, because now the script suggested by stevelw links, as intended, to individual PDF Expert files.
Are the PDF Expert scripts still working with PDFE 2.5.3 and Mojave? I believe that I have installed them correctly, but I am still getting “No linkable item found” when I invoke Hook.
Thanks.
Thanks Luc. Tried increasing delay to 0.5 with no effect. BUT, I have discovered some strange behaviour that may have a bearing.
I use Path Finder (7) instead of Finder. I have tried applying both the script above and the one in the PDF Expert & Notability thread in the Get Address window. Currently I am using the one on this page, unchanged except for “delay 0.5”.
When I open a document in PDF Expert and invoke Hook, focus switches to Path Finder and the file for the document I am looking at is revealed in its PF window. It is as if I had cut straight to “Show in [Path] Finder”.
Curiously, if I change “Finder” in the script to “Path Finder”, focus stays with PDFE on invoking Hook, and just a blank Hook window opens (no linkable items). Then if I replace the Get Address script with the version in the Notability thread, the effect of invoking Hook is to close all open Path Finder windows! Clearly these scripts are not working as intended on my system, but this is probably due to the interaction with Path Finder. (I am also using dual monitors, but I don’t believe this is affecting things.)
@NickSloan I’m using Path Finder (9.2) and the original script from @stevelw works well for me after changing “Finder” to “Path Finder”. However, there’s one “gotcha”: I need to click on the page area of the PDF before invoking Hook. If I don’t do that, I get a blank Hook window, as you found.
I’m still trying to find out exactly which conditions cause the script to fail. If I use a keyboard command to move to a new tab in PDF Expert, or activate PDF Expert via LaunchBar, it seems to fail. But if I first click on the page I want to link to, AFAIK it always works.
GUI scripting is a pain. If there’s any combination of keystrokes that would move the focus to the page area of the current PDF, maybe we could add that to the script.
Agreed. Still, we’ll have another look at that UI scripting, but we can’t commit to this working.
We haven’t had a specific commitment yet from Readdle that they will provide the bit of automation required for linking. They would need to be the ones to speak to their automation plans if any, of course. Fingers crossed.
As it stands, however, as you’ve found, PDF expert is currently not a reliable context in which to link PDF documents to one’s digital life.
Several other PDF apps support automation (e.g., PDFPenPro, Skim and Preview).
Even aside from Hook, I have been using and recommending Smile Software’s PDFPenPro for years (e.g., at CogZest). PDFPenPro has OCR and form creation for those who need it. Their customer support is excellent. (I’m certainly not saying competitors’ isn’t.) PDFPen development is quite active. Version 12 was recently released (I’m already using it, Pro version).
This isn’t the forum to do product comparisons. However, for customers who value automation and its features, PDFPenPro is worth considering.
Thanks for the pointer to the Integration page. I’ve been using Hook on and off for a while now, but have only just started to look seriously at what it can do.
Ironically I’ve just moved to PDF Expert from PDFPen 6. I’d previously used the Pro version and agree that the OCR works well – plus of course full scriptability
Looking back at this topic and the one it links to, I couldn’t quickly see that it was mentioned that Gingerlab’s Notability app does not support automation or expose “Copy URL/link” in the UI. I’ve contacted Gingerlab’s support a couple of times; only canned email responses so far but hopefully they will look into it. I’ve added a note on our Linkable apps page to the effect that Notability app’s items are not linkable. We’ve had a couple of customers ask about this recently, which is why I’m updating this topic.
On the positive side, a large number of note taking apps support automated linking; and we may be, I believe, entering a stage where remaining Mac app and SaaS developers will come to understand the importance of hyperlinking in this no longer new century. A chapter authored by myself and @danieljomphe in The Future of Text book ; the chapter is a manifesto on linking automation and user interfaces. I’ll later post a topic on the forum and a new webpage before the book is published, inviting co-signatories.
If Catalyst and apps imported from iOS generally become a bigger part of the ecosystem, scope for reliance on AppleScript glue will inevitably start to shrink. I don’t know if you have other options for getting through that bottle-neck.
I don’t think the barriers are technical (even with iOS). What we need is a commitment from developers to support UI and automated linking. This in turn hinges on market demand. Hook is part of the process to educe consciousness of the previously relatively hidden (tacit or implied) need for this. The manifesto soon to be published in The Future of Text, and we’ll offer in another form online soon inviting signatories, makes it clear that we are not calling for specific API’s (that would not be realistic), but general requirements (for UI and APIs) that automators and apps like Hook can leverage. E.g., we are not saying something like “implement xpath for deep linking” – that would not be realistic; just provide some automated support for deep linking (e.g., in the case of PDFs, to get page number and x,y of selection).
(2020-08-12 13:39: somehow my previous attempt to edit my reply turned into a separate reply. So I deleted the first version of my reply).
Is there any update on PDF Expert integration?
Failing that could I have help on pointing me in the direction for information about the steps involved in implementing the script that was provided at the start of this thread.
Thanks.