littlebigman Posted January 30, 2018 Share Posted January 30, 2018 Hi, I'm no AutoIT expert, so it could be something obvious. The following code fails getting (copying) the contents of the Note section of items in Outlook's Tasks list: #include <Constants.au3> #include <MsgBoxConstants.au3> #include <Date.au3> ;Wait for item from Tasks list Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Local $hWndLocal = WinWaitActive("[TITLE:Task; CLASS:rctrl_renwnd32]", "", 10) #cs >>>> Control <<<< Class: _WwG ClassnameNN: _WwG1 Name: Advanced (Class): [CLASS:_WwG; INSTANCE:1] Text: Message Style: 0x56000000 ExStyle: 0x00000010 Handle: 0x00760D2E #ce Local $sNote = ControlGetText($hWndLocal, "", "[CLASSNN:_WwG1]") ;Displays "Message" ! MsgBox($MB_SYSTEMMODAL, "$sNote", $sNote) The following works, but I was wondering why the former doesn't, and if there's a more elegant solution: ;Move from Subject field Send("{TAB 9}") Send("^a") Send("^c") Local $sNote = ClipGet() MsgBox($MB_SYSTEMMODAL, "$sNote", $sNote) Thank you. Link to comment Share on other sites More sharing options...
kosamja Posted January 30, 2018 Share Posted January 30, 2018 Maybe because class _WwG1 is not standard Windows control? Link to comment Share on other sites More sharing options...
Earthshine Posted January 30, 2018 Share Posted January 30, 2018 (edited) water has an Outlook UDF that might help. otherwise it's UIAutomation for you Edited January 30, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
littlebigman Posted January 30, 2018 Author Share Posted January 30, 2018 Thanks. https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General Link to comment Share on other sites More sharing options...
Subz Posted January 31, 2018 Share Posted January 31, 2018 In Outlook select Tasks (tab) ( or select any mail folder) then run the following: $oOutlook = ObjCreate("Outlook.Application") $oOutlookFolder = $oOutlook.ActiveExplorer.CurrentFolder For $i = 1 To $oOutlookFolder.Items.Count $oOutlookItem = $oOutlookFolder.Items($i) ConsoleWrite($oOutlookItem.Subject & @CRLF & $oOutlookItem.Body & @CRLF) Next Link to comment Share on other sites More sharing options...
littlebigman Posted January 31, 2018 Author Share Posted January 31, 2018 (edited) Thanks much. Notes Because of the ConsoleWrite(), click on Tools > Compile, and check "Create CUI instead of GUI EXE" There's no need to add some #include: The required code is available by default with AutoIT By some kind of magic, it can locate the running instance of Outlook and read items from its Tasks window. I'll experiment, and see how to insert each item's Subject + Note sections into an SQLite database. Here's how to display items in a ListView grid: #include <GUIConstantsEx.au3> #include <ColorConstants.au3> GUICreate("listview items", 700, 700) Global $idListview = GUICtrlCreateListView("col1 |col2 ", 10, 10, 650, 650) $oOutlook = ObjCreate("Outlook.Application") $oOutlookFolder = $oOutlook.ActiveExplorer.CurrentFolder For $i = 1 To $oOutlookFolder.Items.Count $oOutlookItem = $oOutlookFolder.Items($i) GUICtrlCreateListViewItem($oOutlookItem.Subject & "|" & $oOutlookItem.Body, $idListview) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited January 31, 2018 by littlebigman 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