Troubleshooting: When Hookmark hangs in a specific app

If you find that Hookmark’s contextual window hangs when it is invoked in a specific app, and that app is supported by Hookmark, but Hookmark does not hang in other supported apps, it might be due to a macOS caching problem unrelated to Hookmark.

This has been reported for Preview app and TextEdit.

Please try these steps:

0-A. Modify Hookmark’s get address script

For Preview issues only, please:

1. Go to Hookmark’s Preferences window > Scripts > Preview > Get Address.
2. Replace Hookmark’s current Preview.app Get Address script with the following script:

tell application "Preview"
set fpath to path of front document
display dialog fpath
set escapedfpath to do shell script "python -c \"import urllib, sys; print (urllib.quote(sys.argv[1]))\" " & quoted form of fpath
display dialog escapedfpath
return "file://" & escapedfpath
end tell

3. Click the Save button.
4. Invoke the Hookmark window on a Preview document.

Please let us know:

1. Do you see the first dialog box? What does it say?
2. Do you see a second dialog box? What does it say?

0-B. Modify Hookmark’s Get Address script with some ObjectiveC

For Preview issues only, please:

1. Go to Hookmark’s Preferences window > Scripts > Preview > Get Address.
2. Replace Hookmark’s current Preview.app Get Address script with the following script:

use framework "Foundation"
property NSMutableCharacterSet : a reference to current application's NSMutableCharacterSet
on urlEncode(input)
tell current application's NSString to set rawUrl to stringWithString_(input)
set charset to NSMutableCharacterSet's URLQueryAllowedCharacterSet's mutableCopy
charset's removeCharactersInString:"?"
set theEncodedURL to rawUrl's stringByAddingPercentEncodingWithAllowedCharacters:charset
return theEncodedURL as Unicode text
end urlEncode
tell application "Preview"
set fpath to path of front document
end tell
return "file://" & urlEncode(fpath)

3. Click the Save button.
4. Invoke the Hookmark window on a document in Preview.

Please let us know:

  • Does the Hookmark window let you Copy Link in this case, such that you can paste it and use it?