C
coolanil.saini
Hi,
I wanted to read mails on the basis of subject, but stuck on the
error can't get every message of IMAP account <account name>. 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
I wanted to read mails on the basis of subject, but stuck on the
error can't get every message of IMAP account <account name>. 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