I was recently handed a project where I was supposed to, amongst other things, update the data. It seemed like an easy project since there was a provided editor built specifically for the application.

Unfortunately, the data was corrupt. I got confirmed that at least one developer had manually edited the database file to update data, something that seems like a big no-no when dealing with CoreData managed database files.

Due to this, the editor crashed and crashed. I tried to dump the data, clean it and create a new one but it failed.

The editor still read the file, so I figured that I should take the data and let the editor save a new - fresh - file so that everything would be fine.

To avoid manually copying and pasting (I tried, but got bored of it) I figured I could automate it. Keyboard Maestro was the first hit on google. After some trial and error I managed to get this script together.

Keyboard maestro script

And here below it is in action. As you see I manually still have to line it up to make it all work, and I have to change the script for each section as they have different amount of columns. I also have to clean some data up at some points, I did not care to make it 100% automated because the database was relatively small to begin with.

Keyboard maestro script in action

Using this I could let the editor save the correct data into a new database file and since then everything has worked fine. I believe setting up this script saved me multiple hours, maybe days of work. And it definitely saved my sanity of the manual work.