Steve Lambert

is back from the Festival of Live Art in Australia.

Auto-delete social media history

A few months ago I started tinkering with Keyboard Maestro Macros to delete my Facebook history. I decided the history doesn’t really benefit me as much as it does Facebook, and it’s notoriously difficult to easily delete old posts, so it became a little puzzle to play around with.

Some further thought and news events led to the non-profit I co-direct to withdraw from Facebook in late February. These news stories have only continued, and I continued to play around with using a macro to un-like a couple thousand posts on twitter, and learning some tricks within Keyboard Maestro along the way that I’m happy to share here.

Here’s some cell-phone video of these scripts in action:

Why delete your social media history?

There’s all kinds of problems with Facebook. You can delete your Facebook account entirely, and there are certainly many reasons to do so. However, maybe you want something more particular – like to get rid of old posts and only keep a history that goes back days or weeks. Or maybe you know your data can be kept by Facebook even you end your account, so you’re hoping deleting the posts in advance decreases that likelihood. Or maybe you want to do other, automated tasks within your social media accounts that the companies behind them don’t want to make easy.

“This looks complicated and I don’t want to deal with all this.”

Don’t want to mess around with Keyboard Maestro? Fair enough, here’s some automated tools that may be easier.

These do the same or related things you can consider.

At this point I have:

  1. Deleted nearly all of my Facebook Fan Page history.
  2. Un-liked everything on twitter
  3. Deleted a lot of my instagram history
  4. Unfollowed everyone on twitter and instagram

Feels good.

How you can use Keyboard Maestro to delete facebook posts

Keyboard Maestro is a mac-only application for automation. You can use it for repetitive keyboard strokes, mouse clicking, dragging, and browser actions. I didn’t think I’d use it as much as I ended up using it. I use it multiple times daily for filing email, manipulating text, and as a work around to poorly designed interfaces.

Here’s how I put together the macro. Read through because you’ll likely want to change it to suit.

Set up variables

I created two variables. The first is called count for how many times the script will run. Note that the number is how many times it will delete OR scroll up 30 pixels. This means if you enter 300, that may not mean it actually deletes 300 posts – experiment a bit.

The second one is pauseTime which is how long the script pauses between steps.  If you’re on a slower connection, it may help to increase this number. You can tweak any of the pauses to your liking – it may not make sense to have all the pauses be the same length. Just remember slowest part is when the page scrolls down and has to wait to load new posts.

Set up a way to cancel

In the the next part, we’re creating a way to cancel the macro with a keypress.

This is helpful because you may come upon a post that needs to be “hidden” instead of deleted and the macro will get stuck. In this case you can just hit esc and move along. (You could also write another part of the macro to handle these situations better, but there weren’t enough instances for me to make it worth the time.)

With the escape key setup, then we move on to activating Safari (or whatever browser you want to run this in)

The guts

Here’s where we start clicking.

All the action is happening at the bottom of the browser window here. We start by scrolling down just a bit, then checking for the ••• menu button. If it’s not seen, the page will scroll down more. So we scroll, then the if statement.

When we’re looking for the ••• menu button, we’re only looking in the lower right hand of the page. This is because more than one button can appear on the page and to handle more than instance on the page would have taken some additional scripting – and the point of scripting is to be lazy, right?

Once this button is clicked, we need to select “Delete this Post” in the menu. That’s in the next part.

Delete and confirm

First we pause so the menu can appear. This usually happens pretty quickly and this would be a good place to adjust the pause time shorter to speed things up.

Then we move the mouse up and to the left slightly to click on delete in the menu. This is why everything happens at the bottom of the page – if the post was higher, the menu would go below the mouse position instead of above it.

Then we pause for the delete confirmation screen to appear.

The next part finds the delete button on the screen and clicks it.

Then you get another pause before starting over. This is mainly so the next post can load if it needs to.

Un-like everything on Twitter

This is a shorter macro that un-likes everything on twitter.

We start by activating Safari (or whatever browser you choose to do this in).

Repeat the action as many times as you like. Note, this repeats scrolling OR unliking, so the number does not equal the number of likes.

Next we scroll down. This will repeat until a heart is seen on the page. If a heart is seen, it will be clicked on. Then pause, and repeat.

There’s no cancel button on this one, but you could add one. It would occasionally get hung up because of load times, but not enough for me to change it.


You can download my version of these macros here.

Remember, you’ll probably need to tweak them a bit and you’ll need Keyboard Maestro if you don’t have it.

“But what about…”

Yes there’s other ways of doing this. You could spend a bit more time and get it working better. For example, the browser plugins and other options listed above can be very useful, or you could do this all with some javascript. If you’re thinking about it, go for it and publish it somewhere!

Related Posts