Jump to content



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,834 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,834 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,834 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,265 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.

[color=#008000;]Using OS: Win 7 Professional[/color][color=#000000;],[/color] Using AutoIt Ver(s): 3.3.6.1 [color=#800080;]/[/color] 3.3.8.1

Posted Image AutoIt Russian Community

 

Posted ImageProjects: ATT - Application Translate Tool [color=#FF0000;][new][/color][color=#FF0000;]|[/color] BlockIt - Block files & folders [color=#FF0000;][new][/color][color=#FF0000;]|[/color] SIP - Selected Image Preview [color=#FF0000;][new][/color][color=#FF0000;]|[/color] SISCABMAN - SciTE Abbreviations Manager [color=#FF0000;][new][/color][color=#FF0000;]|[/color] AutoIt Path Switcher [color=#FF0000;]|[/color] AutoIt Menu for Opera! [color=#FF0000;]|[/color] YouTube Download Center! [color=#FF0000;]|[/color] Desktop Icons Restorator [color=#FF0000;]|[/color] Math Tasks [color=#FF0000;]|[/color] KeyBoard & Mouse Cleaner [color=#FF0000;]|[/color] CaptureIt - Capture Images Utility [color=#FF0000;]|[/color] CheckFileSize Program

 

Posted ImageUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [color=#FF0000;][new][/color][color=#FF0000;]|[/color] AutoIt Syntax Highlight [color=#FF0000;][new][/color][color=#FF0000;]|[/color] Opera Library! [color=#FF0000;]|[/color] Winamp Library [color=#FF0000;]|[/color] GetFolderToMenu [color=#FF0000;]|[/color] Custom_InputBox()! [color=#FF0000;]|[/color] _FileRun UDF [color=#FF0000;]|[/color] _CheckInput() UDF [color=#FF0000;]|[/color] _GUIInputSetOnlyNumbers() UDF [color=#FF0000;]|[/color] _FileGetValidName() UDF [color=#FF0000;]|[/color] _GUICtrlCreateRadioCBox UDF [color=#FF0000;]|[/color] _GuiCreateGrid() [color=#FF0000;]|[/color] _PathSplitByRegExp() [color=#FF0000;]|[/color] _GUICtrlListView_MoveItems - UDF [color=#FF0000;]|[/color] GUICtrlSetOnHover_UDF! [color=#FF0000;]|[/color] _ControlTab UDF! [color=#FF0000;]|[/color] _MouseSetOnEvent() UDF! [color=#FF0000;]|[/color] _ProcessListEx - UDF [color=#FF0000;]|[/color] GUICtrl_SetResizing - UDF! [color=#FF0000;]|[/color] Mod. for _IniString UDFs [color=#FF0000;]|[/color] _StringStripChars UDF [color=#FF0000;]|[/color] _ColorIsDarkShade UDF [color=#FF0000;]|[/color] _ColorConvertValue UDF [color=#FF0000;]|[/color] _GUICtrlTab_CoverBackground [color=#FF0000;]|[/color] CUI_App_UDF [color=#FF0000;]|[/color] _IncludeScripts UDF [color=#FF0000;]|[/color] _AutoIt3ExecuteCode [color=#FF0000;]|[/color] _DragList UDF [color=#FF0000;]|[/color] Mod. for _ListView_Progress [color=#FF0000;]|[/color] _ListView_SysLink [color=#FF0000;]|[/color] _GenerateRandomNumbers [color=#FF0000;]|[/color] _BlockInputEx [color=#FF0000;]|[/color] _IsPressedEx [color=#FF0000;]|[/color] OnAutoItExit Handler [color=#FF0000;]|[/color] _GUICtrlCreateTFLabel UDF [color=#FF0000;]|[/color] WinControlSetEvent UDF [color=#FF0000;]|[/color] Mod. for _DirGetSizeEx UDF

 

Posted ImageExamples: ScreenSaver Demo - Matrix included [color=#FF0000;]|[/color] Gui Drag Without pause the script [color=#FF0000;]|[/color] _WinAttach()! [color=#FF0000;]|[/color] Turn Off/On Monitor [color=#FF0000;]|[/color] ComboBox Handler Example [color=#FF0000;]|[/color] Mod. for "Thinking Box" [color=#FF0000;]|[/color] Cool "About" Box [color=#FF0000;]|[/color] TasksBar Imitation Demo

 

[color=#808080;]Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: [color=#800080;]Rating[/color] Posted Image)[/color]

 

* === [color=#808080;]My topics[/color] === *

==================================================

Posted Image

==================================================

[color=#4B0082;]AutoIt is simple, subtle, elegant.[/color] [color=#808080;]© AutoIt Team[/color]


#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