New here & to Hook. Great concept; still getting used to it. But I’m curious as to why PDF Expert & Notability (two popular Mac Apps) are not functional with Hook. I did see the one prior post about PDF Expert (April 11) but it does not reveal much information. Thank you
Hook works with any file based app with out any work. If these apps aren’t showing to macOS in this way, then Hook can use AppleScript or callback-urls, but scripts need adding to Hook to use them.
Some apps don’t provide any way for integration with other apps, which may be the case for the two you mention. Hook can still use AppleScript to use menu commands to get the information it needs but these are harder to do and more likely to break when the apps update.
It would help if you contacted the developers of PDF Expert and asked them to add basic generic support for this. More details here.
In the meantime, here’s a script that works in my testing. It won’t be as reliable as PDF Expert adding scripting support to their app. Add the two scripts in the Script Editor in Hook.
I don’t have a copy of Notability so I can’t check if that app has enough access.
Thanks Steve, I don’t much about scripting. I copied and pasted into the appropriate Hook script window, and now when I try to activate script with PDF Expert open, it causes a switch from pdf expert to my file manager, path finder (which I substitutes for finder on my Mac). Did I do something wrong?
The script is expecting Finder. Try changing:
tell application “Finder”
to:
tell application “Path Finder”
It depends what AppleScript support they have though.
I truly appreciate it, but I cannot get it to work (even when running just “finder”). Thank you for the efforts…….
You could try adding…
delay 0.5
…between each line. This will pause for half a second after each step of the script so you can see what’s happening. What do you see happen on the screen when you run the script? Does it:
- show the file in Finder
- close the Finder window
- switch back to the PDF Expert window
- show the Hook pop up
Nothing different happens; just slows the process down slightly. But, if I leave “finder” in the text, once I activate Hook, I’m moved from PDF Expert to Path Finder with the Hook screen visible but still saying “no valid resource….” If, on the other hand, I substitute path finder for finder in the script, once I activate Hook in PDF Expert, I stay in PDF Expert and get the same Hook window saying the same thing……
Try this script instead for Get Address. I don’t have Path Finder to test it. If it works, let me know, and I’ll update the script on the other thread so everyone can use the same one regardless of if they’re using Finder or Path Finder.
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 "System Events"
set activeApp to name of first application process whose frontmost is true
end tell
if activeApp contains "Path" then -- Using Path Finder not macOS Finder
tell application "Path Finder"
set selItems to selection
set n to count of selItems
if selItems is not missing value then
if n = 1 then
set selFile to get POSIX path of (item 1 of (selItems))
set ext to name extension of item 1 of selItems
if ext = "hook" or ext = "HOOK" then
return read selFile
end if
set selFile to get URL of (item 1 of (selItems))
else
set selFile to URL of (container of (item 1 of selItems))
end if
end if
close front window
activate application "PDF Expert"
end tell
else
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 if
end tell
end tell