Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to only show unread/flagged messages in Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to only show unread/flagged messages in Mail.app
Authored by: rusto on Jan 15, '04 03:08:25PM

Great scripts...but it would be nice to also have one that would be a "show all" as well because after you hide the read/unflagged emails using these scripts the only way I can find to show all emails again is to click another mailbox then click the one I hid emails in again.



[ Reply to This | # ]
Show All
Authored by: foozmeat on Jan 15, '04 03:52:46PM

Hacked up from the original script

[code]
try
tell application "Mail"
set theViewer to front message viewer
set theMsg to messages of theViewer
tell theViewer to set properties to {visible messages:theMsg}
end tell
on error the errMsg number the errNmb
if the errNmb is not -128 then
set the errTxt to "Error: " & the errNmb & ". " & the errMsg
display dialog the errTxt buttons {"Cancel"} default button 1
else
error number -128
end if
end try
[/code]



[ Reply to This | # ]
A script to only show unread/flagged messages in Mail.app
Authored by: armageddon on Jan 15, '04 04:01:35PM
These scripts are just what the doctor ordered, and I agree a show all script would also be nice, so with due acknowledgement to mahakali, here is my modified version of his script to Show All. It is probably a clumsy solution as I am a complete novice with Applescript, but it works for me.

Show All Script:


try
  tell application "Mail"
    set theViewer to front message viewer
    set theMsg to messages of theViewer
    set msgList to {}
    repeat with thisMsg in theMsg
      if flagged status of thisMsg is true or read status of ¬
      thisMsg is true or read status of thisMsg is false then
        set the end of msgList to thisMsg
      end if
    end repeat
    if msgList is {} then
      display dialog "There's no messages in this mailbox."
    else
      tell theViewer to set properties to {visible messages:msgList}
    end if
  end tell
on error the errMsg number the errNmb
  if the errNmb is not -128 then
    set the errTxt to "Error: " & the errNmb & ". " & the errMsg
    display dialog the errTxt buttons {"Cancel"} default button 1
  else
    error number -128
  end if
end try
[robg adds: I formatted the above script for a narrower display, but didn't change anything other than that...]

[ Reply to This | # ]