Last active
August 6, 2020 13:09
-
-
Save CherryDT/c3e33fec3fbb23fa2389fc835b96b23c to your computer and use it in GitHub Desktop.
Revisions
-
CherryDT revised this gist
Feb 28, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,8 @@ ; WinClip is required, from here: https://autohotkey.com/board/topic/74670-class-winclip-direct-clipboard-manipulations/ #include %A_ScriptDir%\WinClipAPI.ahk #include %A_ScriptDir%\WinClip.ahk ; Ctrl+Alt+P = wrap plain text in clipboard to EN code block ^!p::EvernoteCodeWrap() -
CherryDT revised this gist
Feb 28, 2020 . 1 changed file with 21 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,24 @@ ; AutoHotkey script to wrap plain text clipboard contents for Evernote in such a way that they can be pasted as code ; block and won't get double empty lines, removed indents or anything like that. ; By David Trapp ; License: MIT ; WinClip is required, from here: https://autohotkey.com/board/topic/74670-class-winclip-direct-clipboard-manipulations/ #include WinClipAPI.ahk #include WinClip.ahk ; Ctrl+Alt+P = wrap plain text in clipboard to EN code block ^!p::EvernoteCodeWrap() ; Ctrl+Alt+V = wrap plain text in clipboard to EN code block and paste ^!v::EvernoteCodeWrapAndPaste() EvernoteCodeWrapAndPaste() { EvernoteCodeWrap() Send ^v } EvernoteCodeWrap() { plainText := WinClip.GetText() @@ -18,4 +39,3 @@ EvernoteCodeWrap() { WinClip.SetHTML(html) } -
CherryDT revised this gist
Feb 28, 2020 . 1 changed file with 3 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,3 @@ EvernoteCodeWrap() { plainText := WinClip.GetText() @@ -33,7 +12,9 @@ EvernoteCodeWrap() { innerHtml := RegExReplace(innerHtml, "<br>", "</div><div>") innerHtml := RegExReplace(innerHtml, "<div></div>", "<div><br/></div>") innerHtml := RegExReplace(innerHtml, " ", " ") ; Note: normally EN uses <div> for the -en-clipboard part, but with <span> we can save one newline ; The <br/> is unfortunately required for this whole thing to work html := "<span style=""-en-clipboard:true;""><br/></span><div style=""-en-codeblock:true;""><div>" . innerHtml . "</div></div>" WinClip.SetHTML(html) } -
CherryDT revised this gist
Feb 28, 2020 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,12 +21,20 @@ EvernoteCodeWrapAndPaste() { EvernoteCodeWrap() { plainText := WinClip.GetText() ; Clear other formats, most importantly ENML WinClip.Clear() WinClip.SetText(plainText) ; Convert plainText := RegExReplace(plainText, "\t", " ") Transform, innerHtml, HTML, % plainText innerHtml := RegExReplace(innerHtml, "[\r\n]", "") innerHtml := RegExReplace(innerHtml, "<br>", "</div><div>") innerHtml := RegExReplace(innerHtml, "<div></div>", "<div><br/></div>") innerHtml := RegExReplace(innerHtml, " ", " ") html := "<div style=""-en-clipboard:true;""><br/></div><div style=""-en-codeblock:true;""><div>" . innerHtml . "</div></div>" WinClip.SetHTML(html) } -
CherryDT created this gist
Feb 28, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ ; AutoHotkey script to wrap plain text clipboard contents for Evernote in such a way that they can be pasted as code ; block and won't get double empty lines, removed indents or anything like that. ; By David Trapp ; License: MIT ; WinClip is required, from here: https://autohotkey.com/board/topic/74670-class-winclip-direct-clipboard-manipulations/ #include WinClipAPI.ahk #include WinClip.ahk ; Ctrl+Alt+P = wrap plain text in clipboard to EN code block ^!p::EvernoteCodeWrap() ; Ctrl+Alt+V = wrap plain text in clipboard to EN code block and paste ^!v::EvernoteCodeWrapAndPaste() EvernoteCodeWrapAndPaste() { EvernoteCodeWrap() Send ^v } EvernoteCodeWrap() { plainText := WinClip.GetText() plainText := RegExReplace(plainText, "\t", " ") Transform, innerHtml, HTML, % plainText innerHtml := RegExReplace(innerHtml, "[\r\n]", "") innerHtml := RegExReplace(innerHtml, "<br>", "</div><div>") innerHtml := RegExReplace(innerHtml, "<div></div>", "<div><br/></div>") innerHtml := RegExReplace(innerHtml, " ", " ") html := "<div style=""-en-clipboard:true;""><br/></div><div style=""-en-codeblock:true;""><div>" . innerHtml . "</div></div>" WinClip.SetHTML(html) }