My experience with google voice has been great except for one annoyance. On android phone it wouldn't delete me multiple messages at a time. I need to long press each message and then select delete from it. Over the time these tend to be hundreds. This means long pressing all these is not an option. So, you'd think we should be able to select all the read/unread/all messages from the google voice web interface like we can do for the emails on the gmail web interface (by clicking on select all on the inbox after selecting all messages in on the first page) and then be able to delete, etc. Nope, we can't do this on google voice web page. Sucks big time. This means we need to select all the messages on the page we're seeing and then select delete to delete them. Given that there might be hundreds of these messages we might have to select and click delete hundreds of times. Not a viable option for me.
Best option would be to write python code which does an excellent and foolproof job. But, again who has time. I definitely don't. So, I went for not so foolproof solution: applescript. You can make a nice application with applescript that would ask for details like "your username, password" and then store them in the keychain securely and also ask you "yes or no" questions to make sure you know what you're doing, and also which messages like "all/read/unread", etc.
I wanted to make this application but not sure whether it was worth it. In the mean time I put this code in few minutes and ran and my inbox was nice and empty on both web interface as well as on my android google voice app.
This is what I did. First, I logged in onto my gmail web interface from Safari. I saw that there were 253 total messages in my inbox (you can see that on the top right corner). I think each page shows 10 messages. So, I will have to make applescript go through 26 pages. You can program it as (numberOfMessages div 10).
Then I ran this script from applescript editor and in few minutes my inbox was empty. That's it. When I tried to run the same script on my home mac I had few problems. The reason was that on my home mac pressing tab two times was enough to reach select checkbox on the page where as I needed to press tab three time on my office mac.
Anyway, it'd be simple to change these to make it work. As you notice, I'm making applescript open google voice page. It opens it without asking for password as you've already opened your gmail account. Now, it'd wait for 3 seconds. This is to make sure page opened in time before applescript goes onto pressing keys. Increase it in case you've slower internet (I doubt it these days). Ascii character 31 is lower arrow key. Everything is self explanatory.
There is no need for closing the page each and every cycle. The reason I did that was I was already using another applescript script to do some tasks on our dns manager. I simply copied that and modified. Anyway play with it. The other reason is, occasionally it doesn't do what it is supposed to do and so closing and opening the page makes it like starting afresh.
tell application "Safari" activate tell window 1 set current tab to (make new tab with properties {URL:"https://www.google.com/voice"}) delay 3 repeat with n from 0 to 25 tell application "System Events" keystroke tab keystroke tab keystroke tab keystroke space keystroke (ASCII character 31) keystroke return keystroke tab keystroke tab keystroke tab keystroke tab keystroke return end tell delay 3 end repeat tell application "System Events" keystroke "w" using command down end tell end tell end tell
No comments:
Post a Comment