Manage Multiple Gmail Accounts With Autohotkey

If you are like me, you might have multiple Gmail accounts. What does this mean ? It means a long process when you want to switch from an account to another.

But what if you could, in less than 5 seconds, go from your professional account to your personal one without disrupting your workflow ?

When you integrate this URL in an Autohotkey macro, (https://mail.google.com/mail/?logout&hl=en) , it becomes easy to flip flop between different adresses.

Here is how the macro looks like :

F1::
ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true

ie.Navigate("https://mail.google.com/mail/?logout&hl=en")
while ie.readyState != 4 || ie.document.readyState != "complete" || ie.busy
Sleep, 100

ie.document.getElementById("choose-account-0").click()
while ie.readyState != 4 || ie.document.readyState != "complete" || ie.busy
Sleep, 100

ie.document.getElementById("Passwd").value := "Type your password here"
ie.document.getElementById("signIn").click()

ObjRelease(ie)
Return

Please note here that it works with Internet Explorer only. Where you read “choose-account-0”, you have to replace 0 by 1 if you want to set your second account and by 2 to set your third account and so on. Where you read “Type your password here”, you have to put your account password.

If you have many accounts, it is a lot more easier to use this macro with an Enterpad because you don’t need to remember where your hotkeys are and you do not interfere with your function keys on your computer keyboard.

By Philippe Lamarre

Leave a Comment