-
-
Save DaneWeber/fc1bfdd02ee5c6215b69 to your computer and use it in GitHub Desktop.
AHK script to be Windows default mailto app, forwarding to Gmail
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
; Copied from http://www.autohotkey.com/board/topic/39551-change-the-default-mailto-to-gmail/ | |
; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
Haystack = %1% | |
;~ If no paramter is given when the run of it, it registers itself as the default mailto | |
; commented out because I'd rather set it as default by myself. | |
; StringLen, pos, 1 | |
; if (pos = 0) { | |
; RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Classes\mailto\shell\open\command,, "%A_ScriptFullPath%" `%1 | |
; ExitApp | |
; } | |
; Use Regex to match the parts of the mailto: link | |
MailToMatch := RegExMatch(Haystack, "mailto:([^?]+)", MailTo) | |
SubjectMatch := RegExMatch(Haystack, "[&?]subject=([^&]+)", Subject) | |
CCMatch := RegExMatch(Haystack, "[&?]cc=([^&]+)", CC) | |
BCCMatch := RegExMatch(Haystack, "[&?]bcc=([^&]+)", BCC) | |
BodyMatch := RegExMatch(Haystack, "[&?]body=([^&]+)", Body) | |
;~ MsgBox, http://mail.google.com/mail/?view=cm&fs=1&tf=1&su=%Subject1%&to=%MailTo1%&body=%Body1%&cc=%CC1%&bcc=%BCC1%&fs=1 | |
;~ "Sends the mail" with Google to the default browser | |
Run, http://mail.google.com/mail/?view=cm&fs=1&tf=1&su=%Subject1%&to=%MailTo1%&body=%Body1%&cc=%CC1%&bcc=%BCC1%&fs=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment