# Show Hook context window with Applescript?

**URL:** https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397
**Category:** Share Hookmark automation
**Created:** [December 27, 2021, 2:34pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397 "2021-12-27T14:34:00Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![reinier](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/r/f08c70/32.png) [@reinier](https://discourse.hookproductivity.com/u/reinier)
#### Post date: [December 27, 2021, 2:34pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/1 "2021-12-27T14:34:00Z")

</div>

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](https://hookproductivity.com/help/automation/)) but the page doesn’t help me at all unfortunately.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [December 27, 2021, 6:25pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/2 "2021-12-27T18:25:40Z")

</div>

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

```auto
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

---

<div class="post-metadata">

### Author: ![reinier](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/r/f08c70/32.png) [@reinier](https://discourse.hookproductivity.com/u/reinier)
#### Post date: [December 27, 2021, 7:12pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/3 "2021-12-27T19:12:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [December 27, 2021, 8:11pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/4 "2021-12-27T20:11:27Z")

</div>

How about this one:

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

```

---

<div class="post-metadata">

### Author: ![reinier](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/r/f08c70/32.png) [@reinier](https://discourse.hookproductivity.com/u/reinier)
#### Post date: [December 28, 2021, 2:17pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/5 "2021-12-28T14:17:25Z")

</div>

> [@bchend](#):
>
> ```auto
> 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?

---

<div class="post-metadata">

### Author: ![bchend](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@bchend](https://discourse.hookproductivity.com/u/bchend)
#### Post date: [December 28, 2021, 6:18pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/6 "2021-12-28T18:18:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![reinier](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/r/f08c70/32.png) [@reinier](https://discourse.hookproductivity.com/u/reinier)
#### Post date: [December 29, 2021, 1:06pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/7 "2021-12-29T13:06:56Z")

</div>

I get the following error in Keyboard Maestro:

```auto
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).

```

---

<div class="post-metadata">

### Author: ![reinier](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/r/f08c70/32.png) [@reinier](https://discourse.hookproductivity.com/u/reinier)
#### Post date: [December 29, 2021, 1:10pm UTC](https://discourse.hookproductivity.com/t/show-hook-context-window-with-applescript/4397/8 "2021-12-29T13:10:16Z")

</div>

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