18
Remove mailto association and replace with custom script.
Posted by jbjorkman on January 18, 2007 underDeprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line 82
VBScript, Windows
If you want to remove your default mailto association you need to manually associate
mailto with something else (a script in this example).
When you click a mailto link HKEY_CLASSES_ROOT\mailto is checked to see which associated mail program you have.
HKEY_CLASSES_ROOT is a combined view made from HKLM\Software\Classes and HKCU\Software\Classes.
HKCU\Software\Classes takes precendence because you want to be able to have user-unique associations.
Add the following to HKCU\Software\Classes\mailto
DefaultIcon\(Default) REG_EXPAND_SZ "%ProgramFiles%\INTERN~1\hmmapi.dll,1"
Shell\Open\Command\(Default) REG_EXPAND_SZ "wscript "[Path to Script]\MailAssoc.vbs" %1
MailAssoc.vbs
Option Explicit
Dim oArgs
Dim sArg
Dim sClipTextSet oArgs=WScript.ArgumentsFor Each sArg in oArgs
if instr(sArg,"@") then
sClipText=sArg
sClipText=trim(replace(lcase(sClipText),"mailto:",""))
end if
Nextif sClipText<>"" then
if MsgBox("Press Ok to copy address to your clipboard" & vbCRLF & sClipText,1,"No email program association found.")=1 then
Dim oIE
Set oIE=Createobject("internetexplorer.application")
oIE.navigate "about:blank"
oIE.document.parentwindow.clipboardData.setData "Text",sClipText
oIE.quit
Set oIE=Nothing
end if
End if