Unable to Read mails from Entourage IMAP account

Hi,

I wanted to read mails on the basis of subject, but stuck on the error can’t get every message of IMAP account . I got the error on “repeat with k in messages of folder named InboxFolder of IMAP account IMAPAccountName” this line… I am using Entourage 2008.

Script as follows:

global IMAPAccountName
global passMsg

set IMAPAccountName to "Anil"
set passMsg to "No unread message"

tell application "Microsoft Entourage"
	activate
	set IMAPaccounts to {} as list
	set m to 1 as number
	repeat with i in IMAP accounts
	set IMAPaccounts to (IMAPaccounts & name of i)
	if (item m of IMAPaccounts) = IMAPAccountName then
	                set n to 1 as number
		set mailFolders to {} as list
		repeat with j in folders of IMAP account IMAPAccountName
			set mailFolders to (mailFolders & name of j)
			if (item n of mailFolders) = "INBOX" then
			--display dialog (item n of mailFolders)
			set InboxFolder to (item n of mailFolders)
			--display dialog InboxFolder
		repeat with k in messages of folder named InboxFolder of IMAP account IMAPAccountName
			set messageName to (subject of k) as string
			--display dialog messageName
			set readStatus to (read status of k) as string
			--display dialog readStatus
		try
			--display dialog messageName & " " & readStatus
		if (messageName = "Event accepted: Simple" and readStatus = "untouched") then
		open k
		set passMsg to "Email related to the meeting is successfully read on Mail application"
		--return j
		end if
				
		on error errmsg
		return "Fail. Could not read email. Error: " & errmsg
		end try
		end repeat
		exit repeat
	end if
	set n to (n + 1)
	end repeat
	--end tell
	exit repeat
end if
set m to (m + 1)
end repeat
end tell

(* close the mail window *)
tell application "System Events"
	tell process "Microsoft Entourage"
	try
	
	if (name of window 1 = "Event accepted: Simple") then
	repeat while (name of window 1 = "Event accepted: Simple")
		tell window 1 -- At this stage window 1 is window of the email.
			--click button 1
			keystroke "w" using command down
		                --return name of window 1
	                end tell
	end repeat
	return "Pass. " & passMsg
	end if
				
on error errmsg
	return "Fail.  " & errmsg
end try
end tell
end tell

Please, help me to sort out the problem.

regards,
anil

Hi,

welcome :slight_smile:

Please post in the OS X forum, if you have questions and use the AppleScript tags for the code portion.
The Code Exchange forum is actually for sharing completed scripts.

Moved the topic from the Code Exchange section to the OS X section, so that it gets more attention.

Hi,
I have your same problem too…
Did you find a solution ?

Please let me know if you have some tricks…

TIA

Rita


set IMAPAccountName to "Anil"

tell application "Microsoft Entourage"
	activate
	
	set listFolders to every folder of IMAP account IMAPAccountName
	
        repeat with i in listFolders
		if (name of i) = "INBOX" then
			set inbx to i
		end if
	end repeat
	
        set allMsg to every message of inbx
	repeat with i in allMsg
		display dialog subject of i as string
	end repeat
end tell

regards,
anni :slight_smile: