mattschinkel Posted July 14, 2012 Posted July 14, 2012 Hello, I am having trouble getting the text out of the treeview in Microsoft Outlook. I'd like to write a script that pops up a message box when my inbox shows unread items like; inbox(1). I know I can create rules, but rules do not work for shared email addresses, and I can't use the outlook UDF because data is stored on the exchange server, not locally. I am able to get the handle, but not the control ID or text of any items. Here's what I have so far: #include <GuiTreeView.au3> Opt("WinTitleMatchMode", 2) $OutlookTree = ControlGetHandle("Microsoft Outlook", "", "[CLASS:NetUIHWND;INSTANCE:1]") ConsoleWrite("Handle: " & $OutlookTree & @crlf) $item = GUICtrlRead($OutlookTree) ; Get the controlID of the current selected treeview ConsoleWrite("Item control ID: " & $item & @crlf) $text = GUICtrlRead($item, 1) ; Get the text of the treeview item ConsoleWrite("Item selected text: " & $text & @crlf) $text = _GUICtrlTreeView_GetItemParam($OutlookTree) ConsoleWrite("GetItemParam: " & $text & @crlf) The output is: Handle: 0x0005040E Item control ID: 0 Item selected text: 0 GetItemParam: False Please help!
water Posted July 14, 2012 Posted July 14, 2012 You could use my extended OutlookEX UDF. You can either handle the event that's triggered when a new mail arrives. Or if you need to handle mails that arrive while Outlook or your script isn't active you can search a folder for the number of unread mails. 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
mattschinkel Posted July 14, 2012 Author Posted July 14, 2012 Thanks, This is perfect! _OL_Example_NewMail_Event.au3 is exactally what I need, I don't even need to modify it
water Posted July 14, 2012 Posted July 14, 2012 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
mattschinkel Posted July 14, 2012 Author Posted July 14, 2012 Well... I spoke too soon. It works perfectly for anything in my personal email, but not for the group email account
water Posted July 14, 2012 Posted July 14, 2012 Then please have a look at the example script _OL_ItemFind.au3 - example 4. It searches a folder for unread items and returns just the number. 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
mattschinkel Posted July 15, 2012 Author Posted July 15, 2012 I can't search any folder since there isn't one. The mail comes from an networked exchange server. Maybe I should also mention that I can't setup any rules for this group email. I will need to read the outlook treeview to see if any mail arrives. Any idea's?
mattschinkel Posted July 15, 2012 Author Posted July 15, 2012 Well, I did try your _OL_ItemFind, It seems to work but it takes way too long. I still need to read the outlook treeview to see if any mail arrives unless there is another solution.
water Posted July 15, 2012 Posted July 15, 2012 This should run faster: $aFolder = _OL_FolderAccess(...) $aFolderInfo = _OL_FolderGet($oOL, $aFolder[1])returns an array where element 7 is the "Number of unread items in the folder" 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
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