Hi,
Trying to learn some more things here, and have been running into an issue with creating files from a clipboard. One of the most annoying tasks I frequently do is: copy something from Excel, paste it into TextMate, run some regex search and replace, and store the result down as a file.
The last section has been simplified a lot now, by having a KM Macro that runs all the different regex on whatever file I've got selected in Finder - which is great. But I thought I'd take the automation one step further by also including the actual creation of the file.
My end goal for the Macro will be that I select the text I want in Excel, execute the Macro which then copies the selected text, asks me for the name of the File, creates the file, runs the regex covered by the existing Macro, and voila. All good.
I think I've got most of this covered, but I'm struggling with getting the content of the Clipboard to work as expected.
If I paste the old fashion way (manually) after copying from Excel, the result would look like this (with \t representing a tab and \n representing a line shift):
ColumnHeader1**\tColumnHeader2\n**
Column1Row1**\tColumn2Row1\n**
Column1Row2**\tColumn2Row2\n**
However, if I copy from Excel and run my test "Create File" Macro, which is just writing a Test File with Clipboard as content, it ends up looking like this (with \n representing a line shift):
ColumnHeader1**\n**
ColumnHeader2**\n**
Column1Row1**\n**
Column2Row1**\n**
Column1Row2**\n**
Column2Row2**\n**
So the structure is changed for some reason, with tabs seemingly being turned into line shifts. Any idea what I'm doing wrong or how I could get around this issue?
Thanks!