Jump to content
bootislands

[HELP] Enhance Evernote editor by using WinClip, an autohotkey library

Recommended Posts

For adding more hotkeys with Evernote's editor, I'm using WinClip. This is effect:

88e10423gw1eri558chlvg20ad041dja.gif

This is core script:

evernoteEdit(eFoward, eEnd)    {        ;BlockInput On        clipboard =        Send ^c        ClipWait, ,        t := WinClip.GetText()        html = %eFoward%%t%%eEnd%       ;add raw html format        WinClip.Clear()        WinClip.SetHTML(html)        Sleep, 300        Send ^v        Return    }    #1::evernoteEdit("<div style='color: #F02E37;'><b>", "</b></div>")    !f::evernoteEdit("<div style='margin-top: 5px; margin-bottom: 9px; word-wrap: break-word; padding: 8.5px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(245, 245, 245); border: 1px solid rgba(0, 0, 0, 0.148438)'>", "</div>")    !1::evernoteEdit("<div style='background: #FFFAA5;'>", "</div>")

But bugs exist:

88e10423gw1eri5bnu20pg20h304p0w2.gif

For bug 1, I tried to backup original format first, then adding new format outside the original, but still not working well.
For bug 2, after backup raw html, it's working, but at same time introducing some gibberish, like below. By debug, guess maybe the coding issue, UTF-8/ANSI, but don't know how to fix it.

UPDATE: BUG 2 solved at here, BUG1 still need help.

 

88e10423gw1eri62253ykg20hb06yq83.gif


This is the new code associated, please check it. Thanks:

evernoteEdit(eFoward, eEnd)    {        clipboard =        Send ^c        ClipWait, ,        t := WinClip.GetHTML()          ;get html, not text, for backup original format        RegExMatch(t, "s)(?<=StartFragment-->)(.*?)(?=<!--EndFragment)", t)     ;remove needless part, to get raw html only        html = %eFoward%%t%%eEnd%        WinClip.Clear()        WinClip.SetHTML(html)        Sleep, 300        Send ^v        Return    }

Share this post


Link to post

×
×
  • Create New...