Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Open Mail Client


  • Please log in to reply
12 replies to this topic

#1 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 14 January 2007 - 12:43 AM

My Simple UDF to open the defult mail Client.
Downloads: Posted Image
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 by BrettF, 05 February 2009 - 12:41 PM.








#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,710 posts

Posted 14 January 2007 - 01:45 AM

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):



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).

#3 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 14 January 2007 - 03:33 AM

[quote name='Zedna' post='293602' date='Jan 13 2007, 07:45 PM']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²Û-[+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.


#4 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 14 January 2007 - 03:59 AM

can make your if 1 line

I know, it looks better and it's easier to read my way...

#5 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,710 posts

Posted 14 January 2007 - 04:09 AM

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.

#6 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 14 January 2007 - 06:05 AM

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....

#7 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,710 posts

Posted 14 January 2007 - 01:42 PM

Thankyou, This is my first upload so....

Or another way to catch it (instead of Opt("RunErrorsFatal",0)):

before Run()

#8 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 23 November 2007 - 12:15 AM

@Bert

In your UDF there is a potential problem - when you return, the Opt() is not restored to initial value :P

And for the other clients, such as Opera Mail, this function should cover the most possible pathes:

AutoIt         
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 by MsCreatoR, 23 November 2007 - 12:24 AM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image 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 ProgramPosted Image UDFs: 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 UDFPosted Image 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 DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#9 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 23 November 2007 - 02:18 AM

Thanks Mate. I created this a long time ago, before I actually got somewhere with this...

#10 Squirrely1

Squirrely1

    Stove pipe won't shut.

  • Active Members
  • PipPipPipPipPipPip
  • 726 posts

Posted 11 April 2008 - 04:12 AM

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 by Squirrely1, 11 April 2008 - 06:02 AM.

Das Häschen benutzt Radar

#11 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 11 April 2008 - 12:01 PM

Bit of an old bump, but thanks? I guess...

#12 Squirrely1

Squirrely1

    Stove pipe won't shut.

  • Active Members
  • PipPipPipPipPipPip
  • 726 posts

Posted 11 April 2008 - 12:50 PM

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 by Squirrely1, 11 April 2008 - 12:54 PM.

Das Häschen benutzt Radar

#13 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 10 November 2008 - 09:27 AM

Hey Guys,

Just updated the function. It is now hosted by my site, and using suggestion from MrCreator.

Cheers,

Brett




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users