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


Click here to return to the 'Show summaries of Mail's flagged emails on the Desktop ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Show summaries of Mail's flagged emails on the Desktop
Authored by: Sesquipedalian on May 15, '10 12:32:46PM
I fiddled some more, and produced this version. Instead of redirecting the output of the osascript command to a file, I now have osascript itself writing the file. Also, I've supplied all the AppleScript code as a series of direct arguments to osascript; this means that a separate .scpt file is unnecessary, in contrast to the original hint.

Just paste the following command into your Geeklet's command field:

outputfile=~/Documents/flagged\ mail\ list.txt; osascript -e "tell application \"System Events\"" -e "if exists (application process \"Mail\") then" -e "set newline to ASCII character 10" -e "set finalText to \"Flagged Mail:\" & newline" -e "tell application \"Mail\"" -e "set theMessages to every message in inbox whose flagged status is true" -e "repeat with i from 1 to number of items in theMessages" -e "set thisMessage to item i of theMessages" -e "set fromMsg to (sender of thisMessage as string)" -e "set subjMsg to (subject of thisMessage as string)" -e "set finalText to finalText & \"! \" & word 1 of fromMsg & \": \" & subjMsg & newline" -e "end repeat" -e "end tell" -e "set thefile to open for access posix file \"$outputfile\" write permission true" -e "set eof of thefile to 0" -e "write finalText to thefile starting at eof" -e "close access thefile" -e "end if" -e "end tell"; cat $outputfile

If you want, you can replace the ~/Documents/flagged\ mail\ list.txt bit at the beginning of the command with some other file path.

[ Reply to This | # ]