Saturday, 1 June 2013

Clipboard Processing with AutoHotkey

I've been doing a lot of text processing recently, and a lot of it has been to convert a column of cells from Excel into a comma separated list. Well, I used to do that with Notepad++, but last week I bit the bullet and wrote an AutoHotkey script to do it for me. Without further ado, here are the goods:

#v::
    StringReplace, Clipboard, Clipboard, `r`n, `,%A_Space%, All
    Clipboard := RTrim(Clipboard, ", `n")
; Gets rid of the annoying trailing newline that Office programs put in.
    Send ^v
Return


It will paste the converted clipboard contents when you press Windows+V. Also, I found a way to get text/content copied from MS Office to plain, plain text by removing the trailing newline character.

No comments:

Post a comment