-------------------------------------------------------------------------------------------
tell application "Mail"
set inBoxList to name of every account whose enabled is true as list
if (count of inBoxList) = 1 then
set theAddRuleMailbox to item 1 of inBoxList
else
set theAddRuleMailbox to choose from list inBoxList ¬
with prompt "Please choose an Account to which to add the Mail rule " & return & return & "\"Move to '* items to shift'\"." & return ¬
with title "Mail Manager add Mail rule" OK button name ¬
"Choose this Inbox Account" cancel button name ¬
"I'll set the rule myself" default items {item 1 of inBoxList}
if length of theAddRuleMailbox = 1 then set theAddRuleMailbox to item 1 of theAddRuleMailbox
set accountEmailAddressList to email addresses of account theAddRuleMailbox
if length of accountEmailAddressList = 1 then set accountAddress to item 1 of accountEmailAddressList
end if
end tell
-------------------------------------------------------------------------------------------