redder Posted January 12, 2009 Share Posted January 12, 2009 (edited) Hello! I want to run the standard email client with a predefined body. In this body are several special characters. (I use Weswolf's "_INetMail()" function) However my problem is, that in the email client everything after the ampersand ("&") is not beeing copied. I had the same problem in basic. There I had to replace the special character with it's HEX-code. In AutoIT this doesn't work - there you only get the HEX-codes in the standard email client not the real characters. Does anyone know why? Thanks in advance, sorry for my substandard English and best regards! redder Edited January 12, 2009 by redder Link to comment Share on other sites More sharing options...
KaFu Posted January 12, 2009 Share Posted January 12, 2009 Upsa #2 .... In fact the _INetExplorerCapable() is part of _INetMail() and seemed to be the problem!.... hmmm, this tweaked function works with Lotus Notes at least, but you might run into other problems due to the now missing IE compliance check... expandcollapse popup#include <INet.au3> ;$Address = InputBox('Address', 'Enter the E-Mail address to send message to') ;$Subject = InputBox('Subject', 'Enter a subject for the E-Mail') ;$Body = InputBox('Body', 'Enter the body (message) of the E-Mail') $Address = "test@test.com" $Subject ="äää?üü?üß" $Body = "tes?tää=ääüüü" $Subject = StringReplace($Subject,'&','%26') $Subject = StringReplace($Subject,'?','%3F') $Body = StringReplace($Body,'&','%26') $Body = StringReplace($Body,'?','%3F') MsgBox(0,"",$address & @crlf & $subject & @crlf & $body) MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail2($address, $subject, $body)) Func _INetMail2($s_MailTo, $s_MailSubject, $s_MailBody) Local $prev = opt("ExpandEnvStrings", 1) Local $var = RegRead('HKCR\mailto\shell\open\command', "") Local $ret = Run(StringReplace($var, '%1', 'mailto:' & $s_MailTo & '?subject=' & $s_MailSubject & '&body=' & $s_MailBody)) Local $nError = @error, $nExtended = @extended opt("ExpandEnvStrings", $prev) Return SetError($nError, $nExtended, $ret) EndFunc ;==>_INetMail #cs Func _INetMail($s_MailTo, $s_MailSubject, $s_MailBody) Local $prev = opt("ExpandEnvStrings", 1) Local $var = RegRead('HKCR\mailto\shell\open\command', "") Local $ret = Run(StringReplace($var, '%1', _INetExplorerCapable('mailto:' & $s_MailTo & '?subject=' & $s_MailSubject & '&body=' & $s_MailBody))) Local $nError = @error, $nExtended = @extended opt("ExpandEnvStrings", $prev) Return SetError($nError, $nExtended, $ret) EndFunc ;==>_INetMail #ce OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
redder Posted January 13, 2009 Author Share Posted January 13, 2009 At first thanks for your effort! This is my solution for the problem (instead of including "Inet.au3" I copied parts of it and modified it): Func _INetExplorerCapable($s_IEString) Return $s_IEString EndFunc ;==>_INetExplorerCapable Func specialchars($string) $string = StringReplace($string, "%", "%25", 0, 0) $string = StringReplace($string, "&", "%26", 0, 0) $string = StringReplace($string, "!", "%21", 0, 0) $string = StringReplace($string, "#", "%23", 0, 0) $string = StringReplace($string, "*", "%2A", 0, 0) $string = StringReplace($string, "/", "%2F", 0, 0) $string = StringReplace($string, "?", "%3F", 0, 0) $string = StringReplace($string, "ß", "%DF", 0, 0) $string = StringReplace($string, "§", "%A7", 0, 0) $string = StringReplace($string, '"', "%22", 0, 0) $string = StringReplace($string, "$", "%24", 0, 0) $string = StringReplace($string, @CRLF, "%0A", 0, 0) Return $string EndFunc Func _INetMail($s_MailTo, $s_MailSubject, $s_MailBody) $s_MailBody = specialchars($s_MailBody) Local $prev = opt("ExpandEnvStrings", 1) Local $var = RegRead('HKCR\mailto\shell\open\command', "") Local $ret = Run(StringReplace($var, '%1', _INetExplorerCapable('mailto:' & $s_MailTo & '?subject=' & $s_MailSubject & '&body=' & $s_MailBody))) Local $nError = @error, $nExtended = @extended opt("ExpandEnvStrings", $prev) Return SetError($nError, $nExtended, $ret) EndFunc (It's a dirty way, but it works with my tool ) By the way, KaFu what do you mean with "you might run into other problems due to the now missing IE compliance check"? Link to comment Share on other sites More sharing options...
KaFu Posted January 13, 2009 Share Posted January 13, 2009 Func _INetExplorerCapable($s_IEString) Return $s_IEString EndFunc ;==>_INetExplorerCapable You can just leave this function away, as it does nothing ... By the way, KaFu what do you mean with "you might run into other problems due to the now missing IE compliance check"? Meant the other StringReplace() you did, I did only two... hopefully that's all there is to replace, that's what I meant with "other" problems.... Regards OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now