Skip to content

Instantly share code, notes, and snippets.

Forked from anonymous/AHK-mailto-gmail.ahk
Last active September 13, 2015 00:39
What would you like to do?
AHK script to be Windows default mailto app, forwarding to Gmail
; Copied from
; #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,
;~ "Sends the mail" with Google to the default browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment