Jump to content

[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:


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:


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.



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    }
Link to comment


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

  • Create New...