Hi Water,
Thank you for the reply. How about the attachment of that email,do I use _OL_ItemAttachmentGet to save the attachement? Basically what I'm tring to acheive is that when on user click it would receive email and after which get the subject and save the attachment and lastly process a particular actions. I'm stuck with receiving email, finding the subject and saving the attachemnt portion. The below are the codes that I have tried but I'm encountering error on the array. Could you please guide me where have i gone wrong? Thank you for the help and advice.
#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>
; *****************************************************************************
; Example Script
; This script loops until Shift-Alt-E is pressed to exit.
; *****************************************************************************
HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script
MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!")
Global $oOutlook = _OL_Open()
Global $oOApp = ObjCreate("Outlook.Application")
Global $test = ObjEvent($oOApp, "oOApp_")
While 1
WEnd
Func oOApp_NewMailEx($sOL_EntryId)
Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)
Local $Subject = $oOL_Item.Subject
If $Subject = "TEST 1" Then
MsgBox(4096,"Test","Test MSG received.")
Global $aOL_Item = _OL_ItemFind($oOutlook, $sOL_EntryId, $olMail, "", "", "", "EntryID")
If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemAttachmentGet Example Script", "Could not find a mail item.'. @error = " & @error)
$Result = _OL_ItemAttachmentGet($oOutlook, $aOL_Item[1][0], Default)
If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemAttachmentGet Example Script", "Error getting list of attachments for mail" & @error & ", @extended = " & @extended)
$Result[1][0].Delete
_ArrayDisplay($Result, "OutlookEX UDF: _OL_ItemAttachmentGet Example Script")
else
MsgBox(4096,"Test","Test MSG Not received.")
Endif
EndFunc ;==>oOApp_NewMailEx
Func _Exit()
Exit
EndFunc ;==>_Exit