Created
February 3, 2021 13:16
-
-
Save tdalon/a6accc91b6ee197f9104efa9e285e396 to your computer and use it in GitHub Desktop.
AutoHotkey script to compose a Gmail email in a popped out window.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SingleInstance force | |
SetTitleMatchMode, 2 | |
ComposeTitle = Compose Mail - | |
If WinExist(ComposeTitle . " ahk_exe chrome.exe") { | |
WinActivate | |
return | |
} | |
; Loop on all Chrome Windows | |
WinGet, id, List,ahk_exe Chrome.exe | |
found := False | |
tabSearch = Gmail | |
Loop, %id% | |
{ | |
hWnd := id%A_Index% | |
WinActivate, ahk_id %hWnd% | |
; Loop on all Tabs in Chrome Window | |
WinGetTitle, firstTabTitle, A | |
title := firstTabTitle | |
Loop { | |
if (InStr(title, tabSearch)>0){ | |
found = True | |
break | |
} | |
Send ^{Tab} ; switch to next tab | |
Sleep, 50 | |
WinGetTitle, title, A ;get active window title | |
if (title = firstTabTitle){ | |
break | |
} | |
} ; end Loop Tabs | |
if (found) | |
break | |
} ; end loop Chrome windows | |
If !(found) { | |
Run run C:\Program Files (x86)\Google\Chrome\Application\chrome.exe https://mail.google.com/mail/ca/u/0/#inbox" | |
WinWait, Inbox ahk_exe Chrome.exe | |
} | |
SendInput +c ; Shift+C | |
;WinWait %ComposeTitle% | |
;winmove, A,, 1750, 303, 1725, 935; moving the window to my preferred position | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See stackoverflow question https://stackoverflow.com/questions/65808558/activate-gmail-message-or-open-new-gmail-message-window-with-chrome