qwert Posted August 18, 2015 Share Posted August 18, 2015 If I want to initiate an email from a script, I can just ShellExecute a file like Draft.eml to open a compose window ... IF there's an email client installed, of course.But what if I just want to open a general use window on the desktop for that same client? ... to read new emails, for example.Is anyone aware of a general "run" command that doesn't require knowing which client is installed (i.e., like when eml's start the registered client, whatever it is)?Thanks in advance for any suggestions. Link to comment Share on other sites More sharing options...
water Posted August 18, 2015 Share Posted August 18, 2015 I think ShellExecute should be the way to go. If needed you can specify the "verb" parameter to define the action to be executed when the mail item is being opened. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
qwert Posted August 18, 2015 Author Share Posted August 18, 2015 ShellExecute ... but what?I don't know the identity of the email client ... and draft.eml opens a compose window, which I don't want. What "verb" would open the whole of the client and not a specific email message? (which I don't know, either)If I've missed your point, I apologize. And if there's no known way, that's OK. But it's a feature I need to figure out, so I had to ask.Worst case, I may have to open draft.eml hidden ... and then then try to figure out what's running to support it. But I'd prefer a direct method, of course.Thanks for your response. Link to comment Share on other sites More sharing options...
water Posted August 18, 2015 Share Posted August 18, 2015 Looks like the mail programs are stored in the registry: Search HKEY_LOCAL_MACHINE\Software\Clients\Mail. The default mail program seems to be flaged. Extract the program name and pass it to ShellExecute.Sorry to not be more specific, but I have no Windows system available right now. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted August 18, 2015 Share Posted August 18, 2015 Another idea: What doesShellexecute("mailto:")return? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
qwert Posted August 18, 2015 Author Share Posted August 18, 2015 Search HKEY_LOCAL_MACHINE\Software\Clients\MailGood idea. I looked that up and found this on stack overflow... with this suggestion:Better to read HKEY_CURRENT_USER\Software\Clients\Mail. (But) this only gives you the name of the email application. If you want its executable file name, you have to go on with something like;object mailCommand = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\" + mailClient.ToString() + @"\shell\open\command", "", "none");and then remove anything extraneous from the command-line string that you don't need (quotes, parameters). I'll work toward a RegRead() equivalent.Thanks. Link to comment Share on other sites More sharing options...
qwert Posted August 19, 2015 Author Share Posted August 19, 2015 Well, I've located the proper value (the actual run command) ... but the key path name of "Mozilla Thunderbird" presents a problem, since I don't know ahead of time what it might be ... and there could be multiple clients, I suppose.Can someone offer a suggestion? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 19, 2015 Moderators Share Posted August 19, 2015 Like this. The problem you're going to run into is you will always have some default clients in that list. Even on a brand new install I have Hotmail and Windows Mail. You would have to disregard those unless they're the only entries.Local $sSubKey = "" For $i = 1 to 10 $sSubKey = RegEnumKey("HKLM\SOFTWARE\Clients\Mail", $i) If @error Then ExitLoop ConsoleWrite($sSubKey & @CRLF) Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jvanegmond Posted August 19, 2015 Share Posted August 19, 2015 (edited) Check this key too HKEY_CURRENT_USER\SOFTWARE\Classes\mailtoExecutable should be at HKEY_CURRENT_USER\Software\Classes\mailto\shell\open\commandKey does not exist when no program is set. Edited August 19, 2015 by Manadar Zzz github.com/jvanegmond Link to comment Share on other sites More sharing options...
qwert Posted August 19, 2015 Author Share Posted August 19, 2015 HKEY_CURRENT_USER\Software\Classes\mailto\shell\open\commandEXCELLENT suggestion!That nails it ... and solves the problem of multiple installed clients.Thank you! 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