water Posted October 6, 2012 Share Posted October 6, 2012 Great. Now we still need a solution for an installed but "uninitialised" Outlook. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
storme Posted October 7, 2012 Share Posted October 7, 2012 Well I'm working on that one.... I ran into a computer that had outlook on it but I didn't have a lot of time. I was at a customers home and they don't like it if you spend an hour working on your own "project" and 5 minutes on there's.....then charge them.... I can see why... So I dumped the regestry (regedit - export) before and after thinking I'd compare them when I get home..... Sigh.... I tried Winmerge (crashed), tried ExamDiff (crashed), tried FC (thinks the file is binary and shows difference Character by Character)...... I know they are large files (335 MB) but I woudl have thought one of these would have handled it. Any suggestions? Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
water Posted October 7, 2012 Share Posted October 7, 2012 According to this thread you need to check registry key"HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindowsMessaging SubsystemProfiles"If there are any subkeys then Outlook has been configured. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
storme Posted October 7, 2012 Share Posted October 7, 2012 I found another glitch (Doesn't work for 2003), I wrote a reply and never sent it as I wanded off to find a solution. MUCH searching(google), swearing, cursing and finally.... Here it is. Func _Get_Microsoft_Outlook_Account() Local $sEmailAccount = "not found" Local $registryPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676" Local $constEmail = "Email" Local $sDeafultEmailID = BinaryMid(RegRead($registryPath, "{ED475418-B0D6-11D2-8C3B-00104B2A6676}"), 1, 2) ; Only want first 2 bytes If Not @error Then ;OK registry key was there $sDefaultEmailKey = $registryPath & "\" & Hex(Int($sDeafultEmailID)) If Not @error Then ;OK registry key was there $sEmailAccount = BinaryToString(RegRead($sDefaultEmailKey, $constEmail), 2) $sEmailAccount = StringLeft($sEmailAccount, StringLen($sEmailAccount) - 1) ; email ends in a ZERO so must be clipped EndIf EndIf Return $sEmailAccount EndFunc I've tried it on 2007 and it works perfectly. I"ll post it's big borther that extracts ALL of the accounts data in a new thread when I get time. John Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
water Posted October 7, 2012 Share Posted October 7, 2012 Local $registryPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676"I'm not sure the key always has "Outlook" in this place. IIRC the domain name of my company is put here. Will check as soon as I'm back in my office. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
storme Posted October 7, 2012 Share Posted October 7, 2012 I'm not sure the key always has "Outlook" in this place. IIRC the domain name of my company is put here. Will check as soon as I'm back in my office.In my wanderings aroudn the internet today I didn't find any different references but that maybe the searches I was doing.I tested it on 2007, 2010 and 2003 (the one that was causing problems for the other method). All stand alone computers.Maybe it will require a bit of extra code to work that out and change the base key accordingly.Let me know what you find.John Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
water Posted October 7, 2012 Share Posted October 7, 2012 "Outlook" is the profile name. I will check if there is always an "Outlook" profile or if you just have to check for any subkey in "HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles". I will let you know on Tuesday. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Exit Posted October 7, 2012 Author Share Posted October 7, 2012 Inspired by Water and Storme, I submitted new code in my first post.Here is the changed part:; Func _Get_Microsoft_Outlook_Account() $sAccount = "not found" $key = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook" For $i = 1 To 9999 $subkey = RegEnumKey($key, $i) If @error = -1 Then ExitLoop If @error Then ContinueLoop RegRead($key & "\" & $subkey, "NextAccountID") If @error Then ContinueLoop For $j = 1 To 9999 $varname = RegEnumVal($key & "\" & $subkey, $j) If @error = -1 Then ExitLoop If @error Then ContinueLoop If Not (StringLeft($varname, 1) = "{") Then ContinueLoop $ids = RegRead($key & "\" & $subkey, $varname) If @error Then ContinueLoop $email = RegRead($key & "\" & $subkey & "\" &Hex(Int(BinaryMid($ids, 1, 4))), "Email") If @error Then ContinueLoop $sAccount = StringTrimRight(BinaryToString($email, 2), 1) ExitLoop 2 Next Next Return $sAccount EndFunc ;==>_Get_Microsoft_Outlook_Account ; App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
water Posted October 7, 2012 Share Posted October 7, 2012 Thanks for the updated script, I will test as soon as I'm in my office again. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
storme Posted October 8, 2012 Share Posted October 8, 2012 (edited) Inspired by Water and Storme, I submitted new code in my first post. Here is the changed part: Sorry that will only work if you have only one account... I have heaps... Thats why you need the "{ED475418-B0D6-11D2-8C3B-00104B2A6676}" key (took me ages to find that one). The first byte gives you the "default" account, which is what you want. I'll post this in another thread when Water has confirmed that the "outlook" part of the reg entry is correct but this is the cleaned up version of my research. expandcollapse popupGetALLOutlookAccounts(); Func GetALLOutlookAccounts() Local $registryPath = "HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfilesOutlook9375CFF0413111d3B88A00104B2A6676" Local $constAccountName = "Account Name" Local $constEmail = "Email" ;Local $constSMTPServer = "SMTP Server" Local $constName = "Display Name" ;Local $constIMAPServer = "IMAP Server" ;Local $constPOP3Server = "POP3 Server" Local $constContentsAccountClsid_POP3 = "{ED475411-B0D6-11D2-8C3B-00104B2A6676}" Local $constContentsAccountClsid_IMAP = "{ED475412-B0D6-11D2-8C3B-00104B2A6676}" ;Get Deafult Outlook Email address Local $sEmailAccount = "" Local $sDeafultEmailID = BinaryMid(RegRead($registryPath, "{ED475418-B0D6-11D2-8C3B-00104B2A6676}"), 1, 2) ; Only want first 2 bytes If Not @error Then ;OK registry key was there $sDefaultEmailKey = $registryPath & "" & Hex(Int($sDeafultEmailID)) If Not @error Then ;OK registry key was there $sEmailAccount = BinaryToString(RegRead($sDefaultEmailKey, $constEmail), 2) $sEmailAccount = StringLeft($sEmailAccount, StringLen($sEmailAccount) - 1) ; email ends in a ZERO so must be clipped EndIf EndIf ConsoleWrite("Default Email Address = " & $sEmailAccount & @CR & @CR) ;Get ALL outlook Email addresses Local $sCurrentKey = "" For $i = 1 To 1000 ; ConsoleWrite("$i = " & $i & @CR) $sCurrentKey = $registryPath & "" & RegEnumKey($registryPath, $i) $s_clsid = RegRead($sCurrentKey, "clsid") If @error <> 0 Then ExitLoop If $s_clsid = $constContentsAccountClsid_POP3 Or $s_clsid = $constContentsAccountClsid_IMAP Then $sAccountName = BinaryToString(RegRead($sCurrentKey, $constAccountName), 2) $sAccountName = StringLeft($sAccountName, StringLen($sAccountName) - 1) ; ends in a ZERO so must be clipped ConsoleWrite($constAccountName & " = " & $sAccountName & @CR) $sAccountEmail = BinaryToString(RegRead($sCurrentKey, $constEmail), 2) $sAccountEmail = StringLeft($sAccountEmail, StringLen($sAccountEmail) - 1) ; ends in a ZERO so must be clipped ConsoleWrite($constEmail & " = " & $sAccountEmail & @CR) $sAccountDisplayName = BinaryToString(RegRead($sCurrentKey, $constName), 2) $sAccountDisplayName = StringLeft($sAccountDisplayName, StringLen($sAccountDisplayName) - 1) ; ends in a ZERO so must be clipped ConsoleWrite($constName & " = " & $sAccountDisplayName & @CR) ConsoleWrite(@CR) EndIf Next EndFunc ;==>GetALLOutlookAccounts The only thing it doesn't have is a check to make sure that "outlook" is the correct profile. I'm waiting for water to confirm that before I change the code. John Morrison Edited October 8, 2012 by storme Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Exit Posted October 8, 2012 Author Share Posted October 8, 2012 John, I know that there are more than one account, but my intention is to find the default account.Please confirm, that my script does not display the default account in your cases. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
storme Posted October 8, 2012 Share Posted October 8, 2012 (edited) John, I know that there are more than one account, but my intention is to find the default account.Please confirm, that my script does not display the default account in your cases.Sorry yes you are right it does get the default account.It took a while to unscrable what it was doing. When I bench checked it I missed a step.But I have to ask why? It does the same as except yours searches though each level and builds the final key.As far as my research showed me the keys I used don't change so don't need to be searched for...Just curious.... Edited October 8, 2012 by storme Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Exit Posted October 8, 2012 Author Share Posted October 8, 2012 The key and the variable name are "strange", but I also "googled" them and found that it is very likely, that they will not change. But my approach will work even if they change key and/or variable name in a future release. Only the master key must remain equal. But your approach works as well. A little annotation: The value of the variable is a set of 4 bytes long entries. The first is the default and the following are the remaining account keys. It is not only the first byte. But this is irrelevant until the account number is less than 255. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
storme Posted October 8, 2012 Share Posted October 8, 2012 Good Points! Water mentioned that "outlook" may not even be the profile name. So maybe a higher level "FOR" to search thought all profiles (I only have one) would avoid that possibility. BTW so far so good...I've been using my version on a few computers with no problems. Next time I update the script I'll replace it with your version. Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
water Posted October 8, 2012 Share Posted October 8, 2012 "Outlook" is a profile name. What I'm not sure is: Is there always a default profile named "Outlook"? I will check tomorrow when I'm back in my office! My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Exit Posted October 8, 2012 Author Share Posted October 8, 2012 Just my version of GetALLOutlookAccounts()GetALLOutlookAccounts(); Func GetALLOutlookAccounts() Local Const $registryPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676" Local $opt = Opt("ExpandVarStrings", 1) Local $sDefaultEmailAccount = "" Local $sAllEmailIDs = RegRead($registryPath, "{ED475418-B0D6-11D2-8C3B-00104B2A6676}") While $sAllEmailIDs Local $sEmailId = BinaryMid($sAllEmailIDs, 1, 4) $sAllEmailIDs = BinaryMid($sAllEmailIDs, 5) Local $sEmailKey = $registryPath & "\" & Hex(Int($sEmailId)) Local $sAccountEmail = StringTrimRight(BinaryToString(RegRead($sEmailKey, "Email"), 2), 1) Local $sAccountName = StringTrimRight(BinaryToString(RegRead($sEmailKey, "Account Name"), 2), 1) Local $sAccountDisplayName = StringTrimRight(BinaryToString(RegRead($sEmailKey, "Display Name"), 2), 1) If $sDefaultEmailAccount = "" Then $sDefaultEmailAccount = $sAccountEmail ConsoleWrite("@CR@Default Email Address = $sDefaultEmailAccount$ @CR@@CR@") EndIf ConsoleWrite("Account Name = $sAccountName$ @CR@Email = $sAccountEmail$ @CR@Display Name = $sAccountDisplayName$ @CR@@CR@") WEnd Opt("ExpandVarStrings", $opt) Return $sDefaultEmailAccount EndFunc ;==>GetALLOutlookAccounts ; end of script App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
water Posted October 9, 2012 Share Posted October 9, 2012 As I feared: Our registry key looks like this: "HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles<domain name>" My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
storme Posted October 9, 2012 Share Posted October 9, 2012 As I feared:Our registry key looks like this:"HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles<domain name>"Thats shoudnt' be too hard for EXIT to fix... His code already does a search,all he has to do is to add an extra level. Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Exit Posted October 9, 2012 Author Share Posted October 9, 2012 Thats shoudnt' be too hard for EXIT to fix... His code already does a search,all he has to do is to add an extra level. Yes Sir, fixed it. See post #1.As I feared:Our registry key looks like this:"HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\<domain name>"Water, can you please check if the new code works for you in the domain. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
water Posted October 9, 2012 Share Posted October 9, 2012 Thanks for the code change! Will try tomorrow and post the results. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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