Show Hook context window with Applescript?

I’ve been looking for a solution to open the Hook context window with Applescript (for use in Keyboard Maestro) without the need for a hotkey to initiate it. Is it possible? If so, how?

I was hoping I could find it here (Automation – Hook) but the page doesn’t help me at all unfortunately.

Welcome to the Hook Productivity Forum. Is the followng script you are looking for:

tell application "Hook"
	invoke on (make bookmark with properties {name:"CNN - Breaking News, Latest News and Videos", address:"https://www.cnn.com"})
end tell

Thank you

I don’t think so? I want to activate the context window on the current active object in front of me. So a finder file or a safari tab.

So just like the Control-H shortcut but without using the shortcut.

How about this one:

tell application "Hook"
	set currentBookmark to bookmark from active window
	invoke on currentBookmark
end tell

It works in Safari but not in Omnifocus for example. Is there a more generic way to invoke the context window? Or where can I find documentation on Applescript support for Hook?

That is supposed to be the generic way to invoke Hook context window on the current active document. Is there any error message with Omnifocus? You can find the documentation in Script Editor.
(1)Open a new Script Editor window
(2)File → Open Dictionary…, a window with a list of apps will appear.
(3)Select Hook, click OK
(4)A window with Hook AppleScript dictionary will appear

I get the following error in Keyboard Maestro:

2021-12-29 14:03:38 Action 24223 failed: Execute an AppleScript failed with script error: text-script:77:102: execution error: Hook got an error: Can’t get bookmark id "omnifocus:///task/a_ffNlfOhXo". (-1728)
2021-12-29 14:03:38 Execute an AppleScript failed with script error: text-script:77:102: execution error: Hook got an error: Can’t get bookmark id "omnifocus:///task/a_ffNlfOhXo". (-1728). Macro “Hook” cancelled (while executing Execute AppleScript).

Update: it works now. I think opening the context window with the default shotcut (ctrl-h) first did the trick and flushed something.

1 Like