BrettF Posted January 14, 2007 Share Posted January 14, 2007 (edited) My Simple UDF to open the defult mail Client.Downloads: Download(Direct: http://signa5.com/downloads/_OpenDefaultMail.au3)I needed it for a script never that eventuated into anything.EDIT: Updated 10 November 2008. Now hosted by my site, and using suggestions from MsCreator.Cheers,Brett Edited February 5, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Zedna Posted January 14, 2007 Share Posted January 14, 2007 Usefull. But I discovered in my registry that for Opera is missing shell\open\command key and there is only Protocols\MailTo\shell\open\command with value "C:\PROGRAM FILES\OPERA\OPERA.EXE" "%1" So due to "%1" it's not possible to use Run() Ideas: Also you should make SetError() in some cases (after RegRead): If @error Then SetError(1) Return EndIf And maybe make FileExists() test before Run(), but this is maybe unnecessary because in these registry keys should be always correct paths (to existing EXE's). Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
GaryFrost Posted January 14, 2007 Share Posted January 14, 2007 Usefull. But I discovered in my registry that for Opera is missing shell\open\command key and there is only Protocols\MailTo\shell\open\command with value "C:\PROGRAM FILES\OPERA\OPERA.EXE" "%1" So due to "%1" it's not possible to use Run() Ideas: Also you should make SetError() in some cases (after RegRead): If @error Then SetError(1) Return EndIf oÝ÷ Ø Ý¬zf¤xX¥xLb²Û-zË[yú+y§nëm+"²f²më§ç²Æ«É·jë{azÇ«z¬¶¼¤{+,¥u·²±Ê+ç-¥«a²ÚÆ+-xMý³ú®¢×jy쨺¸ÖX§y«¢+Ù%ÉɽÈQ¡¸IÑÕɸMÑÉÉ½È Ä°Ä°À¤ SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
BrettF Posted January 14, 2007 Author Share Posted January 14, 2007 can make your if 1 line If @error Then Return SetError(1,1,0) I know, it looks better and it's easier to read my way... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Zedna Posted January 14, 2007 Share Posted January 14, 2007 You should use before Run(): Opt("RunErrorsFatal",0) to avoid hard crash if file not exists. Then your test for @error after Run() will work. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BrettF Posted January 14, 2007 Author Share Posted January 14, 2007 You should use before Run(): Opt("RunErrorsFatal",0) to avoid hard crash if file not exists. Then your test for @error after Run() will work. Thankyou, This is my first upload so.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Zedna Posted January 14, 2007 Share Posted January 14, 2007 Thankyou, This is my first upload so.... Or another way to catch it (instead of Opt("RunErrorsFatal",0)): If Not FileExists($mailKey) Then SetError(3) Return EndIf before Run() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MrCreatoR Posted November 23, 2007 Share Posted November 23, 2007 (edited) @BertIn your UDF there is a potential problem - when you return, the Opt() is not restored to initial value And for the other clients, such as Opera Mail, this function should cover the most possible pathes:Func _LaunchDefaultMailClient() Local $Old_Opt_EES = Opt("ExpandEnvStrings", 1) Local $Old_Opt_REF = Opt("RunErrorsFatal", 0) Local $iRetError = 0, $iRetValue = 0 Local $ReadDefMailClient, $ReadCommand $ReadDefMailClient = RegRead("HKLM\SOFTWARE\Clients\Mail", "") If @error Or $ReadDefMailClient = "" Then $iRetError = 1 If $iRetError = 0 Then $ReadCommand = RegRead("HKLM\SOFTWARE\Clients\Mail\" & $ReadDefMailClient & "\shell\open\command", "") If @error Or $ReadCommand = "" Then $iRetError = 2 EndIf If $iRetError = 0 Then If StringRegExp($ReadCommand, '"(.*)"') Then _ $ReadCommand = StringMid($ReadCommand, 2, StringInStr($ReadCommand, '"', 0, 2)-2) If StringInStr($ReadCommand, '/') Then _ $ReadCommand = StringLeft($ReadCommand, StringInStr($ReadCommand, '/', 0, -1)) EndIf If $iRetError = 0 Then $ReadCommand = StringStripWS($ReadCommand, 3) If Not FileExists($ReadCommand) Then $iRetError = 3 EndIf If $iRetError = 0 Then Local $iRetValue = Run($ReadCommand) If @error Then $iRetError = 4 EndIf Opt("ExpandEnvStrings", $Old_Opt_EES) Opt("RunErrorsFatal", $Old_Opt_REF) Return SetError($iRetError, 0, $iRetValue) EndFunc Edited November 23, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
BrettF Posted November 23, 2007 Author Share Posted November 23, 2007 Thanks Mate. I created this a long time ago, before I actually got somewhere with this... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 11, 2008 Share Posted April 11, 2008 (edited) Things do change, squirrely guy who says this in his sig: "Revolt NOW!" - no such thing as aliens ShellExecute("mailto:me@mydomain.com"); launches client with address ShellExecute("mailto:"); launches client WITHOUT address Edited April 11, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
BrettF Posted April 11, 2008 Author Share Posted April 11, 2008 Bit of an old bump, but thanks? I guess... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 11, 2008 Share Posted April 11, 2008 (edited) Bit of an old bump, but thanks? I guess...Pardone me, monsieur - I presume by this that you mean that like I went searching through old threads to dig up this one ?In your defense, we have this: I think that the function "ShellExecute" became available to us not very long ago.And we have this as against me: I was not the first to use the function on a HREF attribute. Edited April 11, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
BrettF Posted November 10, 2008 Author Share Posted November 10, 2008 Hey Guys, Just updated the function. It is now hosted by my site, and using suggestion from MrCreator. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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