Jump to content

OutlookEX UDF - Help & Support (III)


water
 Share

Recommended Posts

I have 2013, and do not get that message after reading or deleting from your script. 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

This version allows to mark a mail as unread and then refreshes the list (the marked item will not be shown any longer):

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <OutlookEX.au3>

Global $aItems, $iItem, $bDisplay = True, $oReply, $bSort = False ; Sort directioen for _GUICtrlListView_SimpleSort
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
AdlibRegister("_RefreshListview", 1000 * 60) ; Refresh each minute
_OL_ErrorNotify(4)
If MsgBox($MB_YESNO, 'Outlook Rules', 'You want to run Outlook rule checker?') <> $IDYES Then Exit MsgBox($MB_OK, 'Quitting App', 'The script will now close.')
Global $oOL = ObjCreate("Outlook.Application")
Global $oEvent = ObjEvent($oOL, "oOApp_")
Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderInbox)
Global $hGUI = GUICreate('New Outlook Email Alert', 800, 200, -1, -1, $WS_SIZEBOX, $WS_EX_TOPMOST)
Global $idOKButton = GUICtrlCreateButton("OK", 10, 150, 85, 25)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKLEFT, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT))
Global $idListview = GUICtrlCreateListView("Received|From|Subject", 10, 10, 780, 130)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM))
; Context Menu
Global $idCM = GUICtrlCreateContextMenu($idListview)
Global $idCM_Display = GUICtrlCreateMenuItem("Display", $idCM)
Global $idCM_Reply = GUICtrlCreateMenuItem("Reply", $idCM)
Global $idCM_Read = GUICtrlCreateMenuItem("Mark as read", $idCM)
GUICtrlCreateMenuItem("", $idCM)
Global $idCM_Delete = GUICtrlCreateMenuItem("Delete", $idCM)
Global $idF5Dummy = GUICtrlCreateDummy()
; Set accelerator for F5
Global $asAccelKeys[1][2] = [["{F5}", $idF5Dummy]]
GUISetAccelerators($asAccelKeys)
GUICtrlSetFont($idListview, Default, Default, Default, "Consolas") ; Monospaced font
GUISetState(@SW_SHOW, $hGUI)
_RefreshListview()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idOKButton
            GUISetState(@SW_MINIMIZE, $hGUI)
        Case $idF5Dummy ; Refresh
            $bDisplay = True
            _RefreshListview()
        Case $idCM_Display
            _OL_ItemDisplay($oOL, $aItems[$iItem + 1][3])
        Case $idCM_Reply
            $oReply = _OL_ItemReply($oOL, $aItems[$iItem + 1][3])
            _OL_ItemDisplay($oOL, $oReply)
        Case $idCM_Delete
            If MsgBox($MB_YESNO, 'Outlook Rules', 'You really want to delete this mail?') = $IDYES Then
                _OL_ItemDelete($oOL, $aItems[$iItem + 1][3])
                $bDisplay = True
                _RefreshListview()
            EndIf
        Case $idCM_Read
            $oItem = $oOL.Session.GetItemFromID($aItems[$iItem + 1][3])
            $oItem.Unread = False
            _RefreshListview()
    EndSwitch
WEnd

Func oOApp_NewMailEx($sOL_EntryId)
    $bDisplay = True
    _RefreshListview()
EndFunc   ;==>oOApp_NewMailEx

;---------------------
; Process GUI messages
;---------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tInfo
    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    Local $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    Local $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $iCode
        Case $LVN_COLUMNCLICK ; A column was clicked
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            _GUICtrlListView_SimpleSort(GUICtrlGetHandle($idListview), $bSort, DllStructGetData($tInfo, "SubItem"))
        Case $NM_DBLCLK ; Sent by a list-view control when the user selects an item by double-clicking
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            $iItem = DllStructGetData($tInfo, "Item")
            _OL_ItemDisplay($oOL, $aItems[$iItem + 1][3])
        Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            $iItem = DllStructGetData($tInfo, "Item")
            ; Disable context menu when no listview item was selected
            If $iItem = -1 Then
                GUICtrlSetState($idCM_Display, $GUI_DISABLE)
                GUICtrlSetState($idCM_Delete, $GUI_DISABLE)
                GUICtrlSetState($idCM_Reply, $GUI_DISABLE)
            Else
                GUICtrlSetState($idCM_Display, $GUI_ENABLE)
                GUICtrlSetState($idCM_Delete, $GUI_ENABLE)
                GUICtrlSetState($idCM_Reply, $GUI_ENABLE)
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

;-----------------------------------------
; Get all unread mails and fill the window
;-----------------------------------------
Func _RefreshListview()
    $aItems = _OL_ItemFind($oOL, $aFolder[1], $olMail, "[UnRead]=True", "", "", "ReceivedTime,SenderName,Subject,EntryID", "", 1)
    If Not IsArray($aItems) Or $aItems[0][0] = 0 Then
        GUISetState(@SW_MINIMIZE, $hGUI)
        $bDisplay = False
        Return
    EndIf
    _GUICtrlListView_BeginUpdate($idListview)
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($idListview))
    For $i = 1 To $aItems[0][0]
        $aItems[$i][0] = StringRegExpReplace($aItems[$i][0], "(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "$1/$2/$3 $4:$5:$6")
        GUICtrlCreateListViewItem($aItems[$i][0] & '|' & $aItems[$i][1] & '|' & $aItems[$i][2], $idListview)
    Next
    _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE) ; Date/time
    _GUICtrlListView_SetColumnWidth($idListview, 1, $LVSCW_AUTOSIZE) ; From
    _GUICtrlListView_SetColumnWidth($idListview, 2, $LVSCW_AUTOSIZE) ; Subject
    ; Now resize the GUI and ListView to fit
    Global $iMaxWidth = 0
    For $i = 0 To 2
        $iMaxWidth += _GUICtrlListView_GetColumnWidth($idListview, $i)
    Next
    _GUICtrlListView_EndUpdate($idListview)
    If $bDisplay = True Then
        WinMove($hGUI, "", Default, Default, $iMaxWidth + 40) ; Just a quick approx - we can refine this
        ControlMove($hGUI, "", $idListview, 10, 10, $iMaxWidth + 25)
        WinActivate($hGUI)
        GUISetState(@SW_RESTORE, $hGUI)
    EndIf
    $bDisplay = False

EndFunc   ;==>_RefreshListview

 

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

@water

I do not work again until Tuesday, so will not be able to test. I did think of something though - I do not have 2010, but I believe at least two in my group does. Maybe an option to surpress those with a variable, I can work out the interface. 

I thank you for your time, and helping me work this out. 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I do not think an option is needed.
When a user displays a mail then property "unread" should be changed. I will insert a save so the message won't appear any longer.

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

Okay...had a chance to run this today. A few things...it is slow to respond to closing the GUI at times - normally after I click to mark an item read, as I am not sure how long the process actually takes?

Also, I did get this error after about an hour of use - not sure if there was only one email in there that I chose to mark as read...I will try to a better job of watching what happens, to see if I can replicate it.
"C:\VM_Shared\AutoIT\q_New Mail Alert_testing_WATER_4.au3" (53) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$oItem = $oOL.Session.GetItemFromID($aItems[$iItem + 1][3])
$oItem = $oOL.Session.GetItemFromID(^ ERROR
->08:16:09 AutoIt3.exe ended.rc:1

EDIT

Found out why this is happening...the emails are set to read, but the GUI is still showing them as unread, as they are still listed on the GUI, so clicking them crashes the app. Note I did do a refresh before trying to open them, and it still showed them.

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

When the list of unread mails is being refreshed it could take a few seconds depending on the number of folders/subfolders and mail items to check.
Maybe a label that shows "List of unread mails is being retrieved" should do the job?

 

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

Okay, when I was using the last version, when I would open an email from it, and then close it, it would just close...but now I am getting that message you posted before about wanting to save changes, can that be an option to suppress. Oh, and as I was writing this, I saved the changes, but the other emails I opened, did not have that popup, so maybe this popup is coming from my POP3 connection I have to another exchange server. I will keep you updated, to see if I can replicated this too.

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Latest version. Saves the item so the message will not be shown.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <OutlookEX.au3>

Global $aItems[1][3], $oItem, $iItem, $iMaxWidth, $bDisplay = True, $oReply, $bSort = False ; Sort direction for _GUICtrlListView_SimpleSort
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
AdlibRegister("_RefreshListview", 1000 * 60) ; Refresh each minute
_OL_ErrorNotify(4)
If MsgBox($MB_YESNO, 'Outlook Rules', 'You want to run Outlook rule checker?') <> $IDYES Then Exit MsgBox($MB_OK, 'Quitting App', 'The script will now close.')
Global $oOL = ObjCreate("Outlook.Application")
Global $oEvent = ObjEvent($oOL, "oOApp_")
Global $aFolder = _OL_FolderAccess($oOL, "", $olFolderInbox)
Global $hGUI = GUICreate('New Outlook Email Alert', 800, 200, -1, -1, $WS_SIZEBOX, $WS_EX_TOPMOST)
Global $idOKButton = GUICtrlCreateButton("OK", 10, 150, 85, 25)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKLEFT, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT))
Global $idListview = GUICtrlCreateListView("Received|From|Subject", 10, 10, 780, 130)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKTOP, $GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM))
; Context Menu
Global $idCM = GUICtrlCreateContextMenu($idListview)
Global $idCM_Display = GUICtrlCreateMenuItem("Display", $idCM)
Global $idCM_Reply = GUICtrlCreateMenuItem("Reply", $idCM)
Global $idCM_Read = GUICtrlCreateMenuItem("Mark as read", $idCM)
GUICtrlCreateMenuItem("", $idCM)
Global $idCM_Delete = GUICtrlCreateMenuItem("Delete", $idCM)
Global $idF5Dummy = GUICtrlCreateDummy()
; Set accelerator for F5
Global $asAccelKeys[1][2] = [["{F5}", $idF5Dummy]]
GUISetAccelerators($asAccelKeys)
GUICtrlSetFont($idListview, Default, Default, Default, "Consolas") ; Monospaced font
GUISetState(@SW_SHOW, $hGUI)
_RefreshListview()
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idOKButton
            GUISetState(@SW_MINIMIZE, $hGUI)
        Case $idF5Dummy ; Refresh
            $bDisplay = True
            _RefreshListview()
        Case $idCM_Display
            $oItem = $oOL.Session.GetItemFromID($aItems[$iItem + 1][3])
            _OL_ItemDisplay($oOL, $oItem)
            $oItem.Save()
        Case $idCM_Reply
            $oReply = _OL_ItemReply($oOL, $aItems[$iItem + 1][3])
            _OL_ItemDisplay($oOL, $oReply)
        Case $idCM_Delete
            If MsgBox($MB_YESNO, 'Outlook Rules', 'You really want to delete this mail?') = $IDYES Then
                _OL_ItemDelete($oOL, $aItems[$iItem + 1][3])
                $bDisplay = True
                _RefreshListview()
            EndIf
        Case $idCM_Read
            $oItem = $oOL.Session.GetItemFromID($aItems[$iItem + 1][3])
            $oItem.Unread = False
            _RefreshListview()
    EndSwitch
WEnd

Func oOApp_NewMailEx($sOL_EntryId)
    $bDisplay = True
    _RefreshListview()
EndFunc   ;==>oOApp_NewMailEx

;---------------------
; Process GUI messages
;---------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tInfo
    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    Local $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    Local $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $iCode
        Case $LVN_COLUMNCLICK ; A column was clicked
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            _GUICtrlListView_SimpleSort(GUICtrlGetHandle($idListview), $bSort, DllStructGetData($tInfo, "SubItem"))
        Case $NM_DBLCLK ; Sent by a list-view control when the user selects an item by double-clicking
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            $iItem = DllStructGetData($tInfo, "Item")
            _OL_ItemDisplay($oOL, $aItems[$iItem + 1][3])
        Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
            $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
            $iItem = DllStructGetData($tInfo, "Item")
            ; Disable context menu when no listview item was selected
            If $iItem = -1 Then
                GUICtrlSetState($idCM_Display, $GUI_DISABLE)
                GUICtrlSetState($idCM_Delete, $GUI_DISABLE)
                GUICtrlSetState($idCM_Reply, $GUI_DISABLE)
            Else
                GUICtrlSetState($idCM_Display, $GUI_ENABLE)
                GUICtrlSetState($idCM_Delete, $GUI_ENABLE)
                GUICtrlSetState($idCM_Reply, $GUI_ENABLE)
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

;-----------------------------------------
; Get all unread mails and fill the window
;-----------------------------------------
Func _RefreshListview()
    $aItems = _OL_ItemFind($oOL, $aFolder[1], $olMail, "[UnRead]=True", "", "", "ReceivedTime,SenderName,Subject,EntryID", "", 1)
    If Not IsArray($aItems) Or $aItems[0][0] = 0 Then
        GUISetState(@SW_MINIMIZE, $hGUI)
        $bDisplay = False
        ;       Return
    EndIf
    _GUICtrlListView_BeginUpdate($idListview)
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($idListview))
    For $i = 1 To $aItems[0][0]
        $aItems[$i][0] = StringRegExpReplace($aItems[$i][0], "(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "$1/$2/$3 $4:$5:$6")
        GUICtrlCreateListViewItem($aItems[$i][0] & '|' & $aItems[$i][1] & '|' & $aItems[$i][2], $idListview)
    Next
    $iMaxWidth = 0
    For $i = 0 To (_GUICtrlListView_GetColumnCount($idListview) - 1)
        _GUICtrlListView_SetColumnWidth($idListview, $i, $LVSCW_AUTOSIZE)
        $iMaxWidth += _GUICtrlListView_GetColumnWidth($idListview, $i)
    Next
    _GUICtrlListView_EndUpdate($idListview)
    If $bDisplay = True Then
        ; Now resize the GUI and ListView to fit
        WinMove($hGUI, "", Default, Default, $iMaxWidth + 57) ; Just a quick approx - we can refine this
        ControlMove($hGUI, "", $idListview, 10, 10, $iMaxWidth + 25)
        WinActivate($hGUI)
        GUISetState(@SW_RESTORE, $hGUI)
    EndIf
    $bDisplay = False
EndFunc   ;==>_RefreshListview

 

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

Testing the latest version, and finding that emails that are in my inbox as unread, are not showing up on the GUI, and that it is no longer popping up, after an email is delivered. But just started testing it, so it could be a one off or something.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Maybe a bug - will check tomorrow.

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

I just started the latest version with two unread mails items in the inbox. The GUI pops up and shows two entries.
Then I sent a mail to myself and it is shown within a second.
Then I minimized the window and sent a second mail: The GUI pops up again and shows all unread mails including the new one.

So: Everything is fine from my side.

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

Strange, as I am still not seeing the popup nor new emails in the GUI. I just sent a test email to myself and also had one in my inbox, when I received my test email, another came in, and no popup nor does the GUI show any of the 3 emails - even after using F5 to refresh. I do know that it works sometimes, as after I posted Tuesday, it had worked, but I will test some more. I have restarted the script, so will report in a bit.

Question: Are you using folders? I have rules that move my emails to different folders, depending on the criteria I set in the rules. I even have a rule for emails that are sent from me, to go in a folder - this was done for testing another function I was using for the Outlook UDF, and just kept it there since then.

 

EDIT After restarting the script - all the emails that I was talking about just a min ago, were in the GUI...so now I am confused.

 

EDIT, since my last edit about 20 mins ago, I have been getting popups, but just sent another message out, from me, and it does not show on the GUI

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

When starting the script it displays all unread mails from all folders.

When a new mail arrives an event is triggered and the EntryID of the new mail is passed to the AutoIt function.
If the Outlook rule then grabs the mail and moves it to another folder a new EntryId is assigned to the this mail item.
Hence the AutoIt function can no longer find the mail using the EntryID it was given as parameter.
So: Could you please deactivate the Outlook rule and test 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

 

See answers in your quote in bold, sorry, I did not feel like parsing each question with quote lol

When starting the script it displays all unread mails from all folders. YES

When a new mail arrives an event is triggered and the EntryID of the new mail is passed to the AutoIt function. I Understand
If the Outlook rule then grabs the mail and moves it to another folder a new EntryId is assigned to the this mail item.
Hence the AutoIt function can no longer find the mail using the EntryID it was given as parameter. I understand
So: Could you please deactivate the Outlook rule and test again? I could do that, and since you said it works, I believe you. But unless there is some other way, I guess I will just add the rule that runs an app when a new email arrives, as not allowing them to get separated into different folders is not going to work for me.

Edit I would also say that your script runs fine for the most part, even if the emails are being directed to other folders, they still show up. So maybe it is something else?

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

It might be a timing problem.

  • If the event that triggers the AutoIt script is run first then the script won't grab the new mail if in the meantime the rule moves the mail to another folder.
  • If the Outlook rule moves the mail before the event for the AutoIt script is being triggered then everything runs as expected.

Only solution that comes to my mind. Add a Sleep or another AdlibRegister to wait until the mail has been moved before checking for new 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

 

Link to comment
Share on other sites

I will keep on testing...thanks for all your help!

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Hi,

I was about to do a VBA macro for profile migrations when I stumbled into this UDF. Looks intriguing! :)

Would it be possible to migrate rules and categories by exporting and importing the settings with this UDF? Is there any known limitations?

My current view is to export the settings to a file and import them from there. If I have understood correctly by looking into the UDF documentation, the route for accomplishing this with rule and category settings would be _OL_RuleGet, _OL_RuleConditionGet, _OL_RuleActionGet, _OL_RuleAdd, _OL_RuleConditionSet, _OL_RuleActionSet and _OL_CategoryGet, _OL_CategoryAdd. Does this sound right? And is it even possible? What could go wrong (last words :D)?

The task looks challenging but I am ready! :) Please heelp

 

Link to comment
Share on other sites

Never tried it but your approach looks promising :) 

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

  • 3 weeks later...

Version 1.1.0.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.

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

  • 1 month later...

Hi water,

 

I'm hoping to find a solution to an issue I'm having. I want to be able to able to have a variable that's populated with an email address. The script would then search through the sent items folder to see if this email address has been contacted previously, and if so, would allow me to do something. I've hacked together a couple examples that seems to be what I want to do, however I'm having an error:

The requested action with this object has failed.:
$oItems = $vFolder.Items.Restrict($sRestrict)
$oItems = $vFolder.Items^ ERROR

 

#include <Includes\OutlookEX.au3>

Global $mailAddress = "test@test.com"
Global $searchAddress = ("[ToAddress]='" & $mailAddress & "' ")

Global $oOutlook = _OL_Open()
If @error Then Exit MsgBox(16, "Error", "Error returned by _OL_Open. @error = " & @error & ", @extended = " & @extended)

Global $aFolder = _OL_FolderAccess($oOutlook, "" , $olFolderSentMail)
If @error Then Exit MsgBox(16, "Error", "Error returned by _OL_FolderAccess. @error = " & @error & ", @extended = " & @extended)

Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, $searchAddress, "", "", "EntryID,Subject,Body", "", 1)
If @error Then Exit MsgBox(16, "Error", "Error returned by _OL_ItemFind. @error = " & @error & ", @extended = " & @extended)
If IsArray($aItems) Then
    _Arraydisplay($aItems, "Example 3")
Else
    MsgBox(16, "OutlookEX UDF - _OL_ItemSearch Example Script", "Error running _OL_ItemSearch. @error = " & @error & ", @extended = " & @extended)
EndIf

Do you have any pointers or suggestions on how I should approach this?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...