NTBM Posted January 6, 2010 Posted January 6, 2010 i am trying to get the current date and time of a selected email. This will be used later for saving it out to a .msg file. i have the script below that will list all the receivedtime for messages in the inbox, but what i am trying to achieve is to switch to outlook (dont care what folder the user is in) and get the timestamp for the item that is selected on their screen. Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",1) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) #include <date.au3> #include <IE.au3> WinWait("Outlook","") If Not WinActive("Outlook","") Then WinActivate("Outlook","") WinWaitActive("Outlook","") Global $olFolderInbox = 6, $sSender = "anyone@anywhere.net.au", $sSubjectSTOP = "sSENTRY STOP", $sSubjectSTART = "sSENTRY START", _ $sSTime, $sSFlag, $receive $o_Outlook = ObjCreate("Outlook.Application") $oNameSpace = $o_Outlook.GetNameSpace("MAPI") $oInbox = $oNameSpace.GetDefaultFolder($olFolderInbox) $oItems = $oInbox.Items For $oItem In $oItems $receive = $oItem.ReceivedTime MsgBox(0,'',"The Date is:" & $receive) Next
veronesi Posted January 5, 2012 Posted January 5, 2012 Hi NTBM Do you have a Solution for your problem? I also try to get the selected mail item in every folder (not only the inbox) Thanks for your reply Best regards Veronesi
water Posted January 5, 2012 Posted January 5, 2012 Hi Veronesi, I am not at my PC at the moment (actually I am on Lanzarote until Sunday ). I will answer your question on Monday. 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
veronesi Posted January 5, 2012 Posted January 5, 2012 Hi water Thanks for your reply. I wish you a nice holiday :-) I need the sender email, the email body text and the subject of the currently selected mail item. Independently of the folder in which it is. (Outbox, Inbox, Custom folder...) I never worked with the outlook UDF because I ONLY need this function. I don't want to include the whole UDF... But if it's working with the outlook UDF, then I can try to "export" the used functions in my program. Thanks for your help! Best regards Veronesi
veronesi Posted January 6, 2012 Posted January 6, 2012 (edited) Hi water!I'm very sorry that I disturb you.But I think, I have the solution with your Outlook UDF.#include <OutlookEx.au3> #include <Array.au3> $oOutlook = _OL_Open() $aReturn = _OL_FolderSelectionGet($oOutlook) $aReturn = _OL_ItemGet($oOutlook, $aReturn[1][1]) ;[1][1] = ID of selected Mail _ArrayDisplay($aReturn) ;Body = [9][1] ;SenderEmailAddress = [64][1] ;TaskSubject = [79][1] _OL_Close($oOutlook)Edit:Hi NTBMFollowing a sample to get the date / time of the currently selected mail item.Independant of the mail folder in which this item is. Hope, this helps#include <OutlookEx.au3> $oOutlook = _OL_Open() $aReturn = _OL_FolderSelectionGet($oOutlook) $aReturn = _OL_ItemGet($oOutlook, $aReturn[1][1]) ;[1][1] = ID of selected Mail $sDate = $aReturn[18][1] $sDate2 = StringMid($sDate, 7, 2) & "." & StringMid($sDate, 5, 2) & "." & StringLeft($sDate, 4) & " - " & StringMid($sDate, 9, 2) & ":" & StringMid($sDate, 11, 2) & ":" & StringMid($sDate, 13, 2) MsgBox(64, "Creation Time", $sDate2) _OL_Close($oOutlook)OutlookEx.au3 from Best regardsVeronesi Edited January 6, 2012 by veronesi
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