'-Opens mailto links with Gmail '-If your viewing this file in your browser either right click the link that sent you here and click "Save As" and save as Mailto.vbs ' or copy and paste this page to a file called Mailto.vbs '-You just need to run this file once so that it can register itself Set WSHShell = CreateObject("WScript.Shell") NewVal = "WScript.exe " & """" & Wscript.ScriptFullName & """" & " " & """" & "%1" & """" CurVal = "-" 'Ignore a non existing key On Error Resume Next CurVal = WSHShell.RegRead("HKEY_CLASSES_ROOT\mailto\shell\open\command\") On Error GoTo 0 'Set the mailto command to the correct path if Not NewVal = CurVal then 'Writting a reg file and calling regedit, avoids direct reg write permissions ImpVal = NewVal ImpVal = Replace(ImpVal,"\","\\") ImpVal = Replace(ImpVal,"""","\""") ImpVal = "@=" & """" & ImpVal & """" WSHShell.CurrentDirectory = WSHShell.ExpandEnvironmentStrings("%TMP%") Set objFS = CreateObject("Scripting.fileSystemObject") Set str = objFS.CreateTextFile("Mailto.reg","TRUE") str.WriteLine("REGEDIT4") str.WriteLine("[HKEY_CLASSES_ROOT\mailto\shell\open\command\]") str.WriteLine(ImpVal) str.Close 'Import reg file and wait WSHShell.Run """%windir%\regedit.exe"" /S ""%TMP%\Mailto.reg""" , 1 , true CurVal = WSHShell.RegRead("HKEY_CLASSES_ROOT\mailto\shell\open\command\") if CurVal = NewVal then MsgBox "Successfully registered with the mailto protocol" else MsgBox "Failed to register with the mailto protocol" end if end if 'Handle Mailo Arg Set args = WScript.Arguments if args.Count > 0 Then URL = "https://mail.google.com/mail/?view=cm&source=mailto&fs=1&" & args.Item(0) URL = Replace(URL,"mailto:","to=") URL = Replace(URL,"?bcc=","&bcc=") URL = Replace(URL,"?cc=","&cc=") URL = Replace(URL,"?subject=","&su=") URL = Replace(URL,"?body=","&body=") WSHShell.Run URL end if