Jump to content
qot

HOWTO: Create hotkeys to set predefined font and H1, H2, H3 styles

Recommended Posts

Alliance,

 

Thanks a lot for this tip! It sure help me :)

 

This is definatelly something I was looking for.

 

We say in your post that you "use a lot of AutoHotKey scripts to automate Evernote". Since I'm looking for this kind of things, I ask if you please can give/share more examples.

 

Thanks in advance.

  • Like 1

Share this post


Link to post

As I was tunning your script to my use I notice it only work in the Evernote main Window.

 

Do you know how can I make also work when I open a single note as a full window?

 

Thanks in advance.

Share this post


Link to post

As I was tunning your script to my use I notice it only work in the Evernote main Window.

 

Do you know how can I make also work when I open a single note as a full window?

 

Thanks in advance.

Change the first line to this and it should work for both the main EN window and the single note window:
GroupAdd, EN_Windows, ahk_class ENMainFrameGroupAdd, EN_Windows, ahk_class ENSingleNoteView#IfWinActive, ahk_group EN_Windows
  • Like 1

Share this post


Link to post

Alliance,

 

Thanks a lot for this tip! It sure help me :)

 

This is definatelly something I was looking for.

 

We say in your post that you "use a lot of AutoHotKey scripts to automate Evernote". Since I'm looking for this kind of things, I ask if you please can give/share more examples.

 

Thanks in advance.

 

I use a lot of scripts that would only make sense for me and they way I use Evernote, but let me know what you're looking for and I'd probably be able to make one for you.

Share this post


Link to post

As I was tunning your script to my use I notice it only work in the Evernote main Window.

 

Do you know how can I make also work when I open a single note as a full window?

 

Thanks in advance.

Change the first line to this and it should work for both the main EN window and the single note window:
GroupAdd, EN_Windows, ahk_class ENMainFrameGroupAdd, EN_Windows, ahk_class ENSingleNoteView#IfWinActive, ahk_group EN_Windows

 

Thanks Scott, I've updated my post.

Share this post


Link to post

Just to say thanks for yours quick and helpfull answers.

 

 

@Qot:

Regarding the bellow comment.

Alliance,

 

Thanks a lot for this tip! It sure help me :)

 

This is definatelly something I was looking for.

 

We say in your post that you "use a lot of AutoHotKey scripts to automate Evernote". Since I'm looking for this kind of things, I ask if you please can give/share more examples.

 

Thanks in advance.

 

I use a lot of scripts that would only make sense for me and they way I use Evernote, but let me know what you're looking for and I'd probably be able to make one for you.

 

For now I can't specify in detail any need. I'm more interested and see others pratices and try to understand what can be good to me use.

 

So I will continue searching.

 

Thanks for all.

Share this post


Link to post

This just makes it appear as if you're using headings, correct? It's not somehow inserting (ENML compatible) h1, h2, h3 objects?

 

Edit: Nevermind. I read it more closely. Obvious answer is obvious.

Share this post


Link to post

Hi Johnny,

 

Regarding your question:

 

Does anyone know a way to use hotkeys for headings on Mac?

 

The only thing I can say, is that Autohotkey is a Windows Software, and so can't be used in Mac OS*.

 

Maybe you should work in Google and in this Forum, if there is any similar way to create headings in Evernote in the Mac OS client.

 

Regards,

Urbano

 

* As far, as I know.

Share this post


Link to post
On 3/7/2014 at 6:48 PM, JohnnyJohnster said:

Does anyone know a way to use hotkeys for headings on Mac?

Here are 2 possible solutions for Mac users using PhraseExpress (Mac and Windows): 

I haven't tried out Keyboard Maestro yet

Share this post


Link to post

It's 2016 and Evernote doesn't have this feature implemented natively yet. I'm really glad that I found this script.

Massive thank you to you qot! Seriously!

Share this post


Link to post
On 7/25/2016 at 3:15 AM, Arcanjo said:

It's 2016 and Evernote doesn't have this feature implemented natively yet. I'm really glad that I found this script.

Massive thank you to you qot! Seriously!

Thanks for the kind words Arcanjo!

I've gone and updated the main script to make it easier for people to add their own styles, have a look.

Share this post


Link to post

autohokey is great (I am using it also for evernote (Vim-like controls). Thank you for you script qot.

However this is really a shame that we still need an external software to be able to work efficiently in Evernote. We are talking about basic content formatting (for years now...).. :x. 

  • Like 1

Share this post


Link to post
10 hours ago, xaa said:

autohokey is great (I am using it also for evernote (Vim-like controls). Thank you for you script qot.

However this is really a shame that we still need an external software to be able to work efficiently in Evernote. We are talking about basic content formatting (for years now...).. :x. 

I totally agree, but I wish more people would give this script a go. I had almost quit using Evernote in frustration until I got this going.

I actually use a great bit of software for journaling called "The Journal" by DavidRM, and it supports styles perfectly. I can't understand why Evernote can't do the same....

Share this post


Link to post

@xaa I've just made a couple of changes to the script which makes it a lot more reliable. There were a few times that keystrokes were getting missed in the Font dialog.

Share this post


Link to post

thank you @qot.  The script wasn't working here (win10).

- added a  coma after IfWinActive.
- added send {tab} line between style & size to switch to the size field.
- (!'ve commented the WinWait line as it seems ok without (at least here..) .

#IfWinActive,  ahk_exe evernote.exe
    ^1::SetFontStyle("bold", 18)
    ^2::SetFontStyle("italic", 16)
    ^3::SetFontStyle("bold", 14)
    ^Space::SetFontStyle("regular", 12)
#IfWinActive

SetFontStyle(weight, size) {
    currentSendMode := A_SendMode ; Get the current Send Mode
    SendMode Event ; Event mode works better in the Font dialog
    Send {Home}+{End} ; Select the current line
    Send ^d ; Open the Font dialog box
    ;WinWait Font, ,5 
    Sleep 200
    Send !y%weight% ; Style
    Send {tab}
    Send !s%size% ; Size
    Send {Enter}
    SendMode %currentSendMode%
}

 

Share this post


Link to post
2 hours ago, xaa said:

thank you @qot.  The script wasn't working here (win10).

Thanks for the feedback. I'm using Win10 as well (and 7), so must be some other trickery going on.

I've added the comma into the OP. The {tab} should be unneccesary as we're sending alt+y and alt+s to switch between those two fields. Was it failing to switch?

Share this post


Link to post

Thank you @qot. Very helpful, and interesting as I needed to learn some PERL stuff several years ago. Key things for me would be to look at making the font consistent throughout the note, and then to modify multi-line headings - selecting them at present only goes to the end of the first or last line (I am not sure which because I haven't tested it enough) and misses the other line(s).

Ultimately, some of the web sites I extract notes from seem to have weird HTML codes that create extra space before headings and text paragraphs. If I could find a way of removing these at the same time I modify the headings I would be very happy.

Share this post


Link to post
4 minutes ago, FactMan said:

Thank you @qot. Very helpful, and interesting as I needed to learn some PERL stuff several years ago. Key things for me would be to look at making the font consistent throughout the note, and then to modify multi-line headings - selecting them at present only goes to the end of the first or last line (I am not sure which because I haven't tested it enough) and misses the other line(s).

Ultimately, some of the web sites I extract notes from seem to have weird HTML codes that create extra space before headings and text paragraphs. If I could find a way of removing these at the same time I modify the headings I would be very happy.

For your use case (multi-line), you could delete the line in the script that says "Send {Home}+{End} ; Select the current line ", and just select the text yourself before pushing the hotkey.

I can't think of any way to programmatically determine whether a heading is one line or multi-line.

  • Like 1

Share this post


Link to post

Thanks for the quick response. I will explore in more detail, but in a regular text file you would be looking for an end of line or end of paragraph character. I recognize that may not apply here - it may be that the underlying text is different... How much of the coding is unique to Endnote? For example, I discovered that it is not easy to make a heading bold italics...

Share this post


Link to post

Ah well, perhaps "programmatically" was a poor choice of words.

I can't figure out how one would do that in AutoHotKey ;)

Share this post


Link to post

Little downside: This nice script only works on English Evernote instances ...

I still don't get it: There are so many great improvements in the evernote client (like "remember view settings"), but things like this are still lacking.

Markdown FTW!

Share this post


Link to post
12 hours ago, andreb said:

Little downside: This nice script only works on English Evernote instances ...

I still don't get it: There are so many great improvements in the evernote client (like "remember view settings"), but things like this are still lacking.

Markdown FTW!

You should be able to easily change it to work with any language.

You'll need to modify the name of the Font dialog. Change the word "Font" to be whatever your one is:

WinWait Font, , 5

And then on these two lines:

Send !y%weight% ; Style
Send !s%size% ; Size    

You'll need to make sure the keyboard shortcuts still work in your language. Here is my Font dialog. Notice how there is an underline under the 'y' of 'Style', and under the 'S' of 'Size'. That is the shortcut key.

ScreenClip [8].png

Have a look in your one and find out what letter it is, and then change the two lines of the script to match. I've highlighted in red the two letters in the snippet of code above.

Save it and reload, and it should work for you!

  • Like 1

Share this post


Link to post
10 hours ago, qot said:

Save it and reload, and it should work for you!

Thanks for your effort qot; my posting was rather to express my frustration with Evernote. It shouldn't be a normal user's task to implement stuff like this ...

Share this post


Link to post

I also really hope that Evernote fix this fast in their next versions:

  • formatting and bookmarks, if possible in the next one.

Although I'm a Pro user, I'm seeing my self using more and more Microsoft Onenote, because of these capabilities.

Evernote excel in information capture. Specially in web information, but must evolve in personal notes creation and editing.

Please change this quickly Evernote, to justify your value\price.

 

  • Like 2

Share this post


Link to post

Your script seems to be using ctrl1, NOT ctrl+1. Otherwise works as described for me on Windows 10. Thanks

  • Like 1

Share this post


Link to post
On 11/17/2016 at 5:21 PM, HotChips said:

Your script seems to be using ctrl1, NOT ctrl+1. Otherwise works as described for me on Windows 10. Thanks

Yes, "Ctrl + 1" means press Control and 1. The plus sign means "in addition to".

Share this post


Link to post

I like how quick this was to setup and edit.  The only drawback at the moment is that the colour selection in the font dialog is limited compared to the colour button on the toolbar.  [I'll mess around with that, or the Paraphrase workaround, later... this works well enough for the moment. The paraphrase/word solution might solve the colour highlighting as well

 

And yes... all these workaround should be completely unnecessary.

Share this post


Link to post

FWIW, My version of the script... inlines the function, but sets the font.  CTRL+SHIFT+0  is the "regular" font.  [Might switch to the Paraphrase style solution though, as I think I can get colour highlighting working with that approach.]

 

Anyone else have interesting versions of this script to share?

 

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

GroupAdd, EN_Windows, ahk_class ENMainFrame
GroupAdd, EN_Windows, ahk_class ENSingleNoteView
#IfWinActive, ahk_group EN_Windows

;; Evernote Styles workaround
; Highlights current line, then opens font dialog, and sets properties
; Limitations: 
; + Colour setting switches between blue/black so needs work
;   + although right now this is beneficial as it allows switching between blue and black, lol (but I'll take that out)
; + Colour selection is limited (the toolbar offers more colours)
; TODO: Paraphrase solution might offer more formatting choices, such as Colour Highlights

; CTRL+SHIFT+1 Heading 1
^+1::
Send {Home}+{End}^d
WinWait Font
Send Tahoma{Tab}Bold{Tab}16{Tab 3}B{Enter}
return

; CTRL+SHIFT+1 Heading 2
^+2::
Send {Home}+{End}^d
WinWait Font
Send Tahoma{Tab}Bold{Tab}14{Tab 3}B{Enter}
return

; CTRL+SHIFT+1 Heading 3
^+3::
Send {Home}+{End}^d
WinWait Font
Send Tahoma{Tab}Bold{Tab}12{Tab 3}B{Enter}
return

; CTRL+SHIFT+0 back to "regular" text when undo doesn't work (resets the colour, so run twice to get black)
; doesn't clear all attributes though... just sets it to 9pt, Regular, Black/Blue
^+0::
Send {Home}+{End}^d
WinWait Font
Send Tahoma{Tab}Regular{Tab}9{Tab 3}B{Enter}
return

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...