Jump to content

Autohotkey Script for Evernote


GoneAway

Recommended Posts

I hope this is the right forum. Lately I've been experimenting with Autohotkey. I went a little overboard and automated everything. I thought some of you might find the ones I wrote up for Evernote useful. Especially the following:

 

Tag Search: Highlight any text and search for it as a tag. This way you can link to tags inside notes.

Search in Google: Highlight any text and search for it on google.

Change Link Color: This one is a bit complicated (and a bit dangerous, don't move or click while it runs) but once you run it it'll allow you to change the link color. It's automatically set to gray, which is what I use, but you can highlight the link, change the color, and it'll change. It works because I discovered links made internally can change their color, but not those copied/pasted (at least on the windows client). Basically it relinks the link.

User Switching: Obviously not as good as Evernote's built in switch for users and obviously a security risk (your username/password has to be entered into the script) but for those of you who share computers and don't mind the slight security risk, it works.

 

Full List of Hotkeys

Basically it's optimized so that you can keep your left hand to the left and your right on your mouse and easily edit/format things. Note that it disables the Capslock key (it produces a horizontal rule instead). The full script I use (and further notes) can be found here. It has a few extra Evernote related hotkeys.

Code for Evernote Section Below.

 

Capslock + 1
Changes to 1st User (set in variables/options).
Capslock + 2
Changes to 2nd User (set in variables/options).
Capslock + 3
Changes to 3rd User (set in variables/options).
Capslock + Alt
Changes the Link Color. Set the mouse cursor right at the end of the link then run. Don't move/click while it runs. You've been warned.
Right Click + Left Click
Searches for selected text as a tag so you can add # Tags to notes then searching them by highlighting Tag and Right Click + Left Click.
Right Click + Scroll Wheel Up
Increases Text Size
Right Click + Scroll Wheel Down
Decreases Text Size

FORMATTING

    Right Click + Ctrl
    Bold
    Right Click + Shift
    Italics
    Right Click + Capslock
    Highlight
    Right Click + Alt
    To-Do Checkbox
    Right Click + Windows
    Bullets
    Right Click + Space
    Create Link
    Right Click + Tab
    Toggles Center/Left Paragraph. It's two shortcuts in one key so holding right click and hitting tab will alternate between the two.

 

Middle Click
Hides Left (Notebook) Panel
Capslock
Horizontal Rule. I have this because I tend to use it a lot to separate clipped text/ideas.
Capslock + Middle Click
Toggles Note Info and Editing Toolbar. See Note Below.
Capslock + Right Click
Increase Indent
Capslock + Left Click
Decrease Indent

 

Updates

  • Fixed it not working in the note view and also simplified some of the scripts. No hotkeys were changed.

Code

;Variables/Options;ignore this, leave at top    GroupAdd,Evernote, ahk_class ENMainFrame    GroupAdd,Evernote, ahk_class ENSingleNoteView    return;If Firefox is elsewhere or if you'd like to use another browser:firefox= C:\Program Files (x86)\Mozilla Firefox\firefox.exe;and if you'd like a different search engine (you can't just past the site, you have to fine the URL thingy):searchengine= http://www.google.com/search?ie=UTF-8&oe=utf-8&q=;Evernote Passwords. I've set up three users, but you can go down to the code and set up more. Make sure to make one for both the log in screen and evernote itself.user1= ;usernameuser1password= ;passworduser2=user2password=user3=user3password=; ============================= EVERNOTE LOG IN ===========================#IfWinActive ahk_group ahk_class #32770; -------- Switch Between Users at Log In ---------------------------------    ; -------- User 1 -----------------------------------------------------            Capslock & 1::                    SetCapsLockState, alwaysoff                    Send, %user1%                    sleep, 500                    Send, {tab}                    sleep, 500                    Send, %user1password%                    sleep, 500                    Send, {Enter}                    return      ; -------- User 2 -----------------------------------------------------            Capslock & 2::                    SetCapsLockState, alwaysoff                    Send, %user2%                    sleep, 500                    Send, {tab}                    sleep, 500                    Send, %user2password%                    sleep, 500                    Send, {Enter}                    return      ; -------- User 3 -----------------------------------------------------            Capslock & 3::                    SetCapsLockState, alwaysoff                    Send, %user3%                    sleep, 500                    Send, {tab}                    sleep, 500                    Send, %user3password%                    sleep, 500                    Send, {Enter}                    return     ; ================================ EVERNOTE ===============================#IfWinActive ahk_group Evernote; -------- User 1 ---------------------------------------------------------            Capslock & 1::                    SetCapsLockState, alwaysoff                    Send {Alt}{F}{O}{enter}                    WinWait, Evernote                    Send, %user1%                    sleep, 500                    Send, {tab}                    sleep, 500                    Send, %user1password%                    sleep, 500                    Send, {Enter}                    return      ; -------- User 2 -----------------------------------------------------            Capslock & 2::                    SetCapsLockState, alwaysoff                    Send {Alt}{F}{O}{enter}                    WinWait, Evernote                    Send, %user2%                    sleep, 500                    Send, {tab}                    sleep, 500                    Send, %user2password%                    sleep, 500                    Send, {Enter}                    return      ; -------- User 3 -----------------------------------------------------            Capslock & 3::                    SetCapsLockState, alwaysoff                    Send {Alt}{F}{O}{enter}                    WinWait, Evernote                    Send, %user3%                    sleep, 500                    Send, {tab}                    sleep, 500                    Send, %user3password%                    sleep, 500                    Send, {Enter}                    return             ;READ NOTE ABOVE BEFORE USING FOLLOWING HOTKEY!!!!!!!!!!!!!!!!!!!    ; -------- Change Link Color ------------------------------------------        Capslock & Alt::            SetCapsLockState, alwaysoff            Send, ^+k            WinWait, Edit Link            Send, ^c            Clipwait,            Send, {Enter}            Send, ^+r            MouseGetPos, xpos, ypos            MouseClickDrag, L, %XPos%, %YPos%, 0, %YPos%            Send, ^k            WinWait, Add Link            Send, ^v            Send, {Enter}            Click, %XPos%, %YPos%,            Send, +{Home}^d            WinWait, Font            Send, {Tab}{Tab}{Tab}{Tab}{Tab}gg{Enter}            SetCapsLockState, alwaysoff            MsgBox,,,Complete, .001            return;NoteToSelf: RBUTTON (L,WU,WD,Ctrl,Shift,Caps,Alt,Win,Tab)    ; -------- Search for Text as Tag -------------------------------------        RButton & LButton::            Send, ^c            ClipWait            Send, {f6}            Send, tag{:}{"}            Send, ^v            Send, {"}            return    ; -------- Increase/Decrease Text -------------------------------------        RButton & WheelUp::Send ^{+}        RButton & WheelDown::Send, ^{-}    ; -------- Formatting: Bold, Italic, Highlight, Bullets, Checkbox, Link -        RButton & Ctrl:: Send, ^b        RButton & Shift:: Send, ^i        RButton & Capslock::  Send, ^+h        RButton & Alt::  Send, ^+c        RButton & LWin::  Send, ^+b        RButton & Space:: Send ^{k}    ; -------- Search Highlighted Text In Google --------------------------        RButton & q::            Send, ^c            ClipWait,            Run, %Firefox% "%searchengine%%clipboard%"            return    ; -------- Center/Left Paragraph --------------------------------------        RButton & Tab::            keywait, LButton            LButtonflag := !LButtonflag            If (LButtonflag)                Send, ^e            else                Send, ^l            return;NoteToSelf: MButton (self)    ; -------- Toggle Left Panel ------------------------------------------        MButton:: Send {f10};NoteToSelf: Capslock(Caps,M,R,L,Tab)    ; -------- Horizontal Rule --------------------------------------------        Capslock::            SetCapsLockState, alwaysoff            Send, ^+{-}            return    ; -------- Show Note Info and Editing Toolbar -------------------------        Capslock & MButton::            SetCapsLockState, alwaysoff            Send ^{F8}            Send {F8}            return    ; -------- Increase/Decrease Indent -----------------------------------        Capslock & RButton::            SetCapsLockState, alwaysoff            Send, ^m            return        Capslock & LButton::            SetCapsLockState, alwaysoff            Send, ^+m            return    ; -------------- 5 Space Tab to Indent ---------------------------------        Tab:: Send, ^m    ;NoteToSelf: Ctrl,L,Alt,Win,Tab normalities don't work for some reason. ARGH    ; -------- Normalities -------------------------------------------------        RButton::Send, {RButton}
Link to comment
  • 2 weeks later...

I've just registered to say: Thank you!

Great bunch of scripts.

 

Based on that I wrote two more ;)

 

Hold Right Mouse Button:

+ click "c" = Copy Note Link

+ click "t" = Insert To Do (checkbox) in place where mouse cursor is

	; -------- Copy note link ------------------------------------------------        RButton & c:: 		SendInput {alt down}		Sleep 50		SendInput n		Sleep 150		SendInput i		Sleep 50		SendInput {alt up}	; -------- Insert To Do ------------------------------------------------        RButton & t:: 		SendInput {LButton}		Sleep 10		SendInput {alt down}		Sleep 10		SendInput o		Sleep 20		SendInput z		Sleep 20		SendInput {Right}		Sleep 20		SendInput w		SendInput {alt up}
Link to comment

Mmm, I didn't think about that, using the Right Click as a Ctrl button and leaving the original letter shorcut (b for bold, etc) That's a good idea. I have something similar set up in Photoshop. I'm going to study it, see if I can fit all the shortcuts to the right hand. Above I focused on the ones I most used, but the more shortcuts the merrier.

 

As for your script, the checkbox one is wrong, it would be D not Z and at least for me, the right and w aren't neccesary (you might be on a different version?), just an Enter. Also it would be easier/faster to just set the checkbox to the shortcut evernote already has for it, instead of going through the alt menu (which makes each script huge). I only used alt for switching users because it had no shortcut. This should work just the same for you:

RButton & t::  Send, ^+c
Link to comment

 

As for your script, the checkbox one is wrong, it would be D not Z and at least for me, the right and w aren't neccesary (you might be on a different version?), just an Enter. Also it would be easier/faster to just set the checkbox to the shortcut evernote already has for it, instead of going through the alt menu (which makes each script huge). I only used alt for switching users because it had no shortcut. This should work just the same for you:

RButton & t::  Send, ^+c

 

1. D vs Z: Good observation. It depends on translation. I'm working with polish version. Here for example to logout actual user you have to send: Send {Alt}{P}{O}{enter}

2. Right, sending Ctrl+Shift+C should work, and it would be better because it is independent to translation but unfortunately it doesn't work for me. Maybe I have something else hooking for these combination? This is why I made this workaround :)

 

Do you have any idea how to make work combinations like: LButton & c? Declaring this combination in script completely blocks using left button when evernote has focus. The only way to return to editor is by Alt+Tab ;)

Link to comment

Ah, okay, I work with the English version. As for 2, the shortcut should be listed next to the menu item. It might be different for you and that's why it isn't working.

 

Autohotkey disables the first key if it's in a combination. That's why I used Capslock as the first key in a lot of them, it was a key I hated I didn't use (though it still manages to turn itself back on accidently sometimes). I also used RButton a lot too because it's a key that doesn't need to be held and can therefore be fixed with

RButton:: Send, {RButton}

If you had used LButton, and added that line, you would only be able to get the click working (no dragging). I've tried everything I could think of (I only know the basics), but I can't get it to work properly. Anyways, this means it's a bad idea to use any keys that you'd need to hold down (like Ctrl or Shift) as the first key. Other keys, like Tab, Alt, or MButton would be better options. I'd recommend MButton if you want something on your mouse. OR you can do:

c & LButton:: Send, keycomboc:: Send, c

You won't be able to hold down C and do ccccccccccc, but I doubt you'd need to do that. I used a similar trick for the indenting: Capslock + RButton and Capslock + LButton since the second key is never disabled.

Link to comment
  • 2 weeks later...
  • 4 weeks later...

Nice work, like the user switching.

 

Myself and friends are obsessed with AHK! I use it heavily with mostly text replacement, shortcuts and power searching.

Like you "google search highlighted text" i use the same but for searching twitter, IMDB, downloading sites and server (void software, everything.exe)

The one thing i have been trying to do though is, "search Evernote with highlighted text" - Have you figured that one out? That would literally make my month.

Link to comment

The one thing i have been trying to do though is, "search Evernote with highlighted text" - Have you figured that one out? That would literally make my month.

 

Hey, this will be easy modification of:

 ; -------- Search for Text as Tag -------------------------------------        RButton & LButton::            Send, ^c            ClipWait            Send, {f6}            Send, tag{:}{"}            Send, ^v            Send, {"}            return

Just removed the lines: Send, tag{:}{"} and Send, {"}

 

So it will be: (also changed binding to RButton+'e' key)

; -------- Search Evernote with highlighted Text -------------------------------------        RButton & e::            Send, ^c            ClipWait            Send, {f6}            Send, ^v            return
Link to comment

Nice work, like the user switching.

 

Myself and friends are obsessed with AHK! I use it heavily with mostly text replacement, shortcuts and power searching.

Like you "google search highlighted text" i use the same but for searching twitter, IMDB, downloading sites and server (void software, everything.exe)

The one thing i have been trying to do though is, "search Evernote with highlighted text" - Have you figured that one out? That would literally make my month.

 

Glad you like the user switching. That's the script started and it snowballed from there.

 

R0bson beat me to it, but that's how you would do it. You could tell it to search practically anywhere (the start menu, your computer, etc). Just make sure if you're switching applications to tell it to wait for the right window, otherwise it'll paste before the program opens (you can see this with userswitching, it waits for the log in screen).

 

I didn't really have a need for it, so I didn't write it. I'm more into using it to automate complicated tasks and connect different applications. If you like AHK, you mght be interested in GlovePIE. I'm currently using it to create a JARVIS like interface. I still like shortcuts for quick actions, but I'd like to get rid of any docks/taskbars in the future. I want to launch applications and switch between them by voice instead. Possible launch searches by voice.

 

As for text replacement, I don't use it. Most of what I type up is original and not repetitive. I don't know where you use it, but if you happen to find yourself having to type up the same things in your browser all the time, like in forms, look into InFormEnter (firefox addon, but similar ones are available for other browsers). I run a blog, and I'm constantly having to input tags. I though about autohotkey at first, but it wasn't right for that problem (30+ tags). I'm currently looking into clipboard replacements that should be able to do something similar, but computer wide.

Link to comment
  • 1 month later...

Hi guys,

 

I just need a little hint sending formatting code to Evernote: I wrote a ahk macro to create a short formatted daily to-do list. However I fail in sending the format keys correctly.

 

For example:

 

SendInput ^bMasterplaner für den %tomorrow%^b{Enter}%tomorrow%{Enter}^bTerminplanung^b{Enter}
 
will create something like this when sent to WordPad:
 

Masterplaner für den 2014.04.09

2014.04.09

Terminplanung

 
However when I send it to an Evernote window, I just get plain text without bold letters etc.
 
How can I fix this?
 
Thanks a lot...
Ralf
 
 

 

Link to comment

@Doc-Ralf

 

It's because you're sending it all at once. If you separate it, it should work, but even then, it's better to add some sleeps, like so:

Key:: (enter here to make clear from here to return is the commands for that key)Send, ^bsleep, 10Send, text bla bla blasleep, 10Send, {Enter}sleep, 10Send, ^breturn

This is a long version, you might be able to shorten, combine a few things, and still have it work most of the time. It depends.

^c for copying has a clipwait feature, so you can do

Send, ^cClipWaitSend, ^v (paste after making sure text was clipped)

and you can wait for windows to pop up with WinWait, but I don't think there's anything for regular keys

Link to comment
  • 3 months later...

Do you know guys if it would be possible with AHK to do the actions below when entering a snippet in the body of a note :

- remove all tags of the note (from 1 to 5 tags, depending what kind of note it is)

- add a new tag to the note based on 1 of the tags that has just been deleted (among the 5 tags, it would be the only tag that doesn't start with a symbol)

- change the notebook

- nest the new created tag under a specific (already existing) tag

 

I'm just discovering AHK and I don't know its limitations yet. From these actions, which one should be doable ?

 

I would like to automate the archiving of completed task in Evernote.

Link to comment

@Silverc75

 

If you can do it with a keyboard and/or mouseclicks (in specific spots) than whatever process can be done with Autohotkey, but once you start throwing more variables at it (x might or might not exist), it gets harder and harder (hence why I labeled some hotkeys "dangerous"). My solutions below are only possible because Evernote happens to have the Tag dialogue list and lists tags in a specific order. I know it can do slightly more than just automating keyboard stuff (I've seen it on the Autohotkey forums which you might want to check out), but I'm not that familiar with it. I only know a little bit of programming. To answer your questions, based on what I do know...

 

- remove all tags of the note (from 1 to 5 tags, depending what kind of note it is)

Yes, from Note > Tags... then you'd have to check Hide unassigned tags. Then clear all. But what you'll actually want to do is the answer to the following.

- add a new tag to the note based on 1 of the tags that has just been deleted (among the 5 tags, it would be the only tag that doesn't start with a symbol)

Working on the above. Note > Tags... Then since most symbols get sorted high on the list, if you were to go all the way down (have it hit the down key quite a few times, it hits the bottom and doesn't go back to the top, so it'll select the only tag without a symbol) then one up, then start unchecking (using the spacebar) from there up.

- change the notebook

Yes. Note > Move to Notebook...

- nest the new created tag under a specific (already existing) tag

I think this one is impossible because to nest you have to drag the tag (which involves a lot of variables).

Link to comment

I'm almost there, but I'm stuck with my desire to add a specific new tag.

 

I want to add a tag that is almost identical to the remaining tag (I cleared all other tags) except that it has an underscore as the beginning of its name. For example "Learn how to use AHK" is the remaining tag and "_Learn how to use AHK" is the tag I want to add to my note.

 

I wanted to clipboard the remaining tag name and then Note > Tags > _ paste

 

But the only way to copy a tag name is by right clicking on the tag > Rename. I don't think I can use Mouseclick because the mouse position will not be always the same...

 

Any ideas ?

Link to comment

Yeah, you can't really unless the mouse can always click in the same space. You can sort of do that if you make EN fullscreen (Windows + Up) as part of the hotkey, ensuring it hits the right place, but not sure how difficult it would be to get it to rename properly. If you can't get it to do that... some other workarounds:

 

What you could do is before you hit the hotkey, type the tag manually somewhere (even the note), select it, backspace (if you wrote it in the note) and have Authotkey store that value to insert when the tag dialogue pops up (AFTER you cleared everything). Unfortunately the tag dialogue doesn't let you rename tags or this would be possible.

 

Now if you only have a few tags you do this with, you could also create several hotkeys, say Ctrl+1, Ctrl+2, Ctrl+3, with each assigning  a different tag, say _tag1, _tag2, _tag3. So you can just glance at which tag you need to "convert" and click the correct hotkey. This of course, is slightly dangerous because you might hit the wrong number.

 

Hope one of those works for you.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...