Global hotkey to launch Obsidian and open QuickAdd capture window using AutoHotKey script

I present to you a very simple hotkey using AutoHotkey to immediately open a QuickAdd (plugin) capture window no matter where you are in Windows desktop.

I was getting antsy of not having a global hotkey to launch Obsidian and a QuickAdd popup to add a note while being anywhere in Windows. I tried couple of tricks posted here including this one. But it was above my IQ level to make it work. I am a noob both in AutoHotkey and Obisidian.

So here is my AutoHotKey script. But first, prerequisites:

  1. You have AutoHotKey app.
  2. You have the QuickAdd community plugin and you have configured a template for daily note. If not, then go over the video tutorial here. Just see the first 10 mts of the video for our purpose here.
  3. In hotkeys config, Alt-Ctrl-C is used for opening the QuickAdd capture window.

The AutoHotKey script:

!^v:: ; Alt-Ctrl-v to run the command
Run [replace with your windows pathname]\Obsidian.exe
Sleep 3000
Send !^c
Return
; END SCRIPT

That’s it. Now when you press Ctrl-Alt-v from anywhere in windows desktop, it would bring up the QuickAdd capture window.
(P.S. if you simply want to launch Obisidian, then just remove these two lines “Sleep 3000
Send !^c”)

Try it and let me know if you have any questions.

                                  UPDATE

Ignore the above script.

I updated it below. Use this instead. Now the script first checks if the program is already running. Use the updated one instead of the above script as it is more complete and robust:

^!v:: ; ctrl-alt-v to run the command
IfWinExist, ahk_exe Obsidian.exe
{
      IfWinExist, ahk_exe Obsidian.exe
		WinActivate, Obsidian.exe
                sleep 500 ; wait till you send the quickadd short cut key where 500 means 0.5 second
                Send, ^!c ; this sends ctrl-alt-c which is shortcut key to add a quick note to today's note
               
     else
		Run, <filepath>/obsidian.exe ; replace <filepath> with your full file path to run the obsidian program
        sleep 4500 ; wait for a longer time till you send the quickadd short cut key because the program is launching where 4500 means 4.5 seconds
        Send, ^!c ; this sends ctrl-alt-c which is shortcut key to add a quick note to today's note
}
; END SCRIPT

Please let me know if you found it useful, or if you have any questions or suggestions.

8 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.