It’s that time of year where I declare bankruptcy on my Instapaper, email review folder and Feedly. Another way I store “interesting things I should read someday” is twitter favourites. Unfortunately twitter don’t provide a way to bulk clear / delete all twitter favourites. I had accumulated
My first thought was to look into using PowerShell to pull and modify the information somehow. I’m sure its possible, but not trivial due to the way twitter authenticates apps.
A kind development team have produced an app called unfavinator, http://unfavinator.com/ that can sign into your account and bulk unfavourite. I’m sure it’s completely legit, but giving 3rd party apps that kind of access makes me nervous. So I turned to Autohotkey. Autohotkey allows you to automate the mouse and keyboard in windows.
Fortunately Twitter has keyboard shortcuts for Favourite/Un-favourite, and Chrome can be controlled with keyboard shortcuts too. So with a simple loop script I can;
- Put my mouse in a position where it will click on the favourite tweet to open it
- Wait for the page to load then send “F” key to unfavourite it
- use alt and left key to send Chrome back a page to the favourites list
- Loop and click the next favourite
; Delete all twitter favourites in Chrome
Loop {
Sleep, 3000 ; second
; Click mouse
MouseClick, left,Sleep, 3000 ; second
Send, f
Sleep, 3000 ; 1 second
Send {Alt Down}
Send {Left}
Send {Alt Up}
} ; close loop
Simple and a little time consuming, but I left it running and it got the job done. A couple of times I had to re-align the mouse. You may need to pay with the sleep timers depending on your page load time.
Here is a quick video of the script running: