Our Alfred workflow has moved from /help2/… to /help/automation/alfred-workflows/. We’ll migrate the rest of the “help2” content into the main help section (/help) as part of the reorganization of Hook’s documentation, replacing the /help2/… pages with links and or redirects.
Alfred does some filtering on the first character. E.g. ‘hm p’ will change the list, but as soon as a second letter ( hm pd) is punched Alfred will switch to google search.
As fare as I can see in the version 1 of the workflow applescript doesn’t support filtering on the argv
Hook version 1.8
macos 10.15.6
Alfred. 4.1.1
Workflow. Version 1
Welcome to the Hook Productivity Forum @yashodhankhare and @jkjelsbak. Thanks for letting us know. And Sorry about that. I forgot to upload the latest version (1.1) of the Alfred workflow from one of our Alfred using devs here (I, myself, use LaunchBar). The new one (1.1) is now linked from our Alfred Workflows for Hook page.
Rats and regrets. I hate it when that happens. (My Finder downloads had multiple copies.) Re-uploaded so the link from Alfred Workflows for Hook – Hook, a page which has not changed, points to to the new version at the same URL. (I don’t share the specific download URL here so that people can pick up the workflow file from this link for versions > 1.1 of the workflow too.
EDIT: Of course I decide to try Hook on the day that v2.0 comes out. I’ll leave this post for now, but mods feel free to remove it since it looks like you’re in the process of updating everything.
–
I’m not sure if I’m running into an error because I’m on Big Sur, or v2.0 of Hook, but this Alfred workflow is not working for me. I made some changes and managed to get it working. Not sure if I broke anything unintentional in the process, but here’s the changes if anyone else is running into issues.
What did I change?
Removed all in set _allBookmarks to all bookmarks
Renamed the title reference of the Hook item to name instead of title in the if argv conditional and set _bookmark line.
use framework "Foundation"
on run argv
-- For troubleshooting in Script Editor
-- set argv to {}
tell application "Hook"
set _allBookmarks to bookmarks
set _listOfUrls to {}
set re1 to a reference to _listOfUrls
set re2 to a reference to _allBookmarks
repeat with i from 1 to (count re2)
set _theItem to item i of re2
if argv is equal to {} or name of _theItem contains argv or address of _theItem contains argv then
set _bookmark to {title:name of _theItem, subtitle:address of _theItem, arg:address of _theItem, icon:"com.cogsciapps.hook"}
copy _bookmark to end of re1
end if
end repeat
if _listOfUrls is not {} then
set {_jsonData, _jsonError} to current application's NSJSONSerialization's dataWithJSONObject:_listOfUrls options:0 |error|:(specifier)
if _jsonData is missing value then error (_jsonError's localizedDescription() as text) number -10000
set res to current application's NSString's alloc()'s initWithData:_jsonData encoding:(current application's NSUTF8StringEncoding)
return ("{\"items\":" & res as text) & "}"
end if
return "{\"items\":[]}"
end tell
end run
Does anyone know if its possible to invoke a new hookmark from within Alfred? I quite often find myself searching for something in Alfred which I then need to add a hook to, but the only way to do it right now is to open or browse to the file and hook from there. It would be great if I could skip the middle step and simply add a Hookmark right from Alfred.