Friday, May 11

Quick Hotkeys in Evernote

Ever since I have started Evernote, I have been surprised to see that the developers see no need to add a stamp dialog hotkey. I don't know how many times I sat with both hands on the keyboard writing something when I realize I want to stamp it and find that I need to go back to the mouse.

This is a fix in AHK (autohotkey). The code is listed below. It is comprised of 4 major features.

1. Launch or open evernote on pressing Ctrl + Shift + E. If its open, it will pop up. If its not, it will be launched. Executable needs to be in the Program Files\Evernote directory.
2. Minimize Evernote on ESC...
3. Maximize or restore Evernote window by pressing F10
4. and Finally, stamp category dialog on last entry in Evernote. This should work with whatever active note you are working on. You can also click on the note in the note list and then use the hotkey. I defaulted the hotkey to Alt + G to activate. I have found that this does not work correctly when there are many form based templates in use. If working off of clippings or text based entries there should be no problem though.

Feel free to change or modify any of these to make them work with your command structure.

AHK can be found at http://www.autohotkey.com if you feel the desire.

If you just want to try the executable, download it here.








The code is as follows


;Persistant


;Evernote

; Launch or Open Evernote
+^e::
IfWinExist, ahk_class ENMainFrame
WinActivate
Else
Run Evernote.exe, %A_ProgramFiles%\Evernote\
Return

;Minimize Evernote on Escape
$ESC::
IfWinActive, ahk_class ahk_class ENMainFrame
WinMinimize
Else
Send, {ESC}
Return

;Fullscreen Evernote on F9
$F10::
IfWinActive, ahk_class ahk_class ENMainFrame
{
Winget, Restore, MinMax
If Restore = 1
WinRestore
Else
WinMaximize
}
Else
Send, {F9}
Return

;Evernote Category on Last Entry
!g::
IfWinExist ahk_class ENMainFrame
{
ControlGetFocus, WhichControl, ahk_class ENMainFrame
IfInString, WhichControl, Html
{
StringMid, Code, WhichControl,11
ControlClick, ENNoteBar%Code%, ahk_class ENMainFrame, , Left, 1, X10 Y10 NA
sleep 100
IfWinNotExist, ahk_class #32770
ControlClick, x%XX% Y%YY% , ahk_class ENMainFrame, , Left, 1, POS NA
}
IfInString, WhichControl, List
{
Send ^{TAB}
ControlGetFocus, WhichControl, ahk_class ENMainFrame
ControlGetPos, XX, YY, WID, HI, %WhichControl%, ahk_class ENMainFrame
XX := XX + 31
YY := YY + 31
ControlClick, x%XX% Y%YY% , ahk_class ENMainFrame, , Left, 1, POS NA
sleep 100
IfWinNotExist, ahk_class #32770
ControlClick, x%XX% Y%YY% , ahk_class ENMainFrame, , Left, 1, POS NA
}
}
Else
Send !g
Return

3 comments:

GTD Wannabe said...

Sweeeet. I've just copied the script and put it into a fresh autohotkey script. It gives me an error at line 43, i.e., " StringMid, Code, WhichControl,11", saying something about needing a fourth argument. I stuck a ",10" at the end of the line and now it seems to be working.

Unknown said...

Thanks a lot, very useful

Kurt said...

Hi - thanks for the script.

The cntl-shft-E seems to work fine for me, but Esc and F10 don't seem to work as indicated. Any suggestions on what I need to look for?

Thanks again,
Kurt