Troubleshooting: When Hook hangs in a specific app
If you find that Hook’s contextual window hangs when it is invoked in a specific app, and that app is supported by Hook, but Hook does not hang in other supported apps, it might be due a a macOS caching problem unrelated to Hook.
This has been reported for Preview app and TextEdit.
Please try these steps:
0-A. Modify Hook’s get address script
For Preview issues only, please
- Go to Hook Preferences window -> Scripts->Preview->Get Address
-
Replace Hook’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 Hook window on a Preview document.
Please let us know:
- do you see the first dialog box? what does it say.
- do you see a second dialog box? what does it say?
0-B. Modify Hook’s get address script with some ObjectiveC
For Preview issues only, please
- Go to Hook Preferences window -> Scripts->Preview->Get Address
-
Replace Hook’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 Hook window on a document in Preview.
Please let us know:
- Does the Hook window let you
Copy Link
in this case, such that you can paste it and use it?