Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.mac.system > #67724
| From | Jolly Roger <jollyroger@pobox.com> |
|---|---|
| Newsgroups | comp.sys.mac.system |
| Subject | Re: A program to show all Mac Mail Rules? |
| Date | 2014-12-19 00:55 +0000 |
| Organization | People for the Ethical Treatment of Pirates |
| Message-ID | <cfhbbjF4nreU1@mid.individual.net> (permalink) |
| References | <54933244$0$29453$c3e8da3$e074e489@news.astraweb.com> <cfh5inF3cs2U2@mid.individual.net> |
On 2014-12-18, Jolly Roger <jollyroger@pobox.com> wrote: > On 2014-12-18, Gary <gary_w1@hotmail.com> wrote: >> Does anyone know of either: >> >> 1- a program to show all the Mac Mail Rules in a report, or >> >> 2- a program to export all the Mac Mail Rules in spreadsheet format, >> that will allow importing into an Excel spreadsheet? > > You can certainly write a short AppleScript script to do it. Which > rule properties (columns) would you want in the spreadsheet? This is rough, but will give you an idea of what I'm talking about. Open this script in Script Editor and then run it, and you will end up with a CSV file with the properties of each rule: <http://jollyroger.kicks-ass.org/software/Export%20Mail%20Rules.zip> Here's the source: -- begin script property exportFilename : "Mail Rules Export.csv" property rEnabledLabel : "enabled" property rDisabledLabel : "disabled" property rAllConditionsOnLabel : "match all" property rAllConditionsOffLabel : "match some" property rDeleteOnLabel : "delete" property rDeleteOffLabel : "do not delete" property rFlagOnLabel : "flag" property rFlagOffLabel : "none" property rMarkReadOnLabel : "mark" property rMarkReadOffLabel : "do not mark" -- ask user to specify destination file set destFile to choose file name with prompt "Export Mail rules to file:" default name exportFilename default location (path to the desktop folder) -- export rules tell application "Mail" try set fileRef to open for access destFile with write permission if fileRef ≠ 0 then -- write column header row set nextRow to "\"name\",\"enabled\",\"match all conditions\",\"delete\",\"forward message\",\"forward recipients\",\"flag\",\"flag index\",\"mark read\",\"sound\",\"redirect\",\"reply\",\"script\",\"copy to\",\"move to\",\"color\",\"action\"" write (nextRow & return as string) starting at 0 to fileRef -- write rule rows repeat with r from 1 to the count of every rule set nextRow to "" set nextRule to item r of (a reference to every rule) set nextRow to nextRow & "\"" & nextRule's name & "\"," if nextRule's enabled then set nextRow to nextRow & "\"" & rEnabledLabel & "\"," else set nextRow to nextRow & "\"" & rDisabledLabel & "\"," end if if nextRule's all conditions must be met then set nextRow to nextRow & "\"" & rAllConditionsOnLabel & "\"," else set nextRow to nextRow & "\"" & rAllConditionsOffLabel & "\"," end if if nextRule's delete message then set nextRow to nextRow & "\"" & rDeleteOnLabel & "\"," else set nextRow to nextRow & "\"" & rDeleteOffLabel & "\"," end if set nextRow to nextRow & "\"" & nextRule's forward text & "\"," set nextRow to nextRow & "\"" & nextRule's forward message & "\"," if nextRule's mark flagged then set nextRow to nextRow & "\"" & rFlagOnLabel & "\"," set nextRow to nextRow & "\"" & nextRule's mark flag index & "\"," else set nextRow to nextRow & "\"" & rFlagOffLabel & "\"," set nextRow to nextRow & "\"\"," end if if nextRule's mark read then set nextRow to nextRow & "\"" & rMarkReadOnLabel & "\"," else set nextRow to nextRow & "\"" & rMarkReadOffLabel & "\"," end if set nextRow to nextRow & "\"" & nextRule's play sound & "\"," set nextRow to nextRow & "\"" & nextRule's redirect message & "\"," set nextRow to nextRow & "\"" & nextRule's reply text & "\"," set nextRow to nextRow & "\"" & nextRule's run script & "\"," if nextRule's should copy message then -- to do: tweak this code to get the name of the "copy to" mailbox (* set destBox to nextRule's copy message set nextRow to nextRow & "\"" & name of destBox & "\"," *) set nextRow to nextRow & "\"copy\"," else set nextRow to nextRow & "\"\"," end if if nextRule's should move message then -- to do: tweak this code to get the name of the "move to" mailbox (* set destBox to nextRule's move message set nextRow to nextRow & "\"" & name of destBox & "\"," *) set nextRow to nextRow & "\"move\"," else set nextRow to nextRow & "\"\"," end if if nextRule's highlight text using color then set nextRow to (nextRow & "\"" & nextRule's color message as string) & "\"," else set nextRow to nextRow & "\"none\"," end if if nextRule's stop evaluating rules then set nextRow to nextRow & "\"stop\"" else set nextRow to nextRow & "\"continue\"" end if write (nextRow & return as string) to fileRef end repeat -- close the file close access fileRef end if display alert "Finished Exporting" message "Exported rules are in this CSV file:" & return & return & the POSIX path of destFile on error beep -- close the file close access fileRef end try end tell -- end script -- E-mail sent to this address may be devoured by my ravenous SPAM filter. I often ignore posts from Google. Use a real news client instead. JR
Back to comp.sys.mac.system | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A program to show all Mac Mail Rules? Gary <gary_w1@hotmail.com> - 2014-12-18 15:00 -0500
Re: A program to show all Mac Mail Rules? Alan Baker <alangbaker@telus.net> - 2014-12-18 12:14 -0800
Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-18 23:16 +0000
Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-19 00:55 +0000
Re: A program to show all Mac Mail Rules? Gary <gary_w1@hotmail.com> - 2014-12-19 17:18 -0500
Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-19 23:18 +0000
Re: A program to show all Mac Mail Rules? Gary <gary_w1@hotmail.com> - 2014-12-19 21:03 -0500
Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-20 03:31 +0000
Re: A program to show all Mac Mail Rules? Gary <gary_w1@hotmail.com> - 2014-12-20 10:08 -0500
Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-20 21:18 +0000
Att:Jolly Roger Re: A program to show all Mac Mail Rules? Gary <gary_w1@hotmail.com> - 2014-12-20 10:47 -0500
Re: Att:Jolly Roger Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-20 21:16 +0000
Re: Att:Jolly Roger Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-22 06:17 +0000
Re: Att:Jolly Roger Re: A program to show all Mac Mail Rules? Gary <gary_w1@hotmail.com> - 2014-12-22 16:16 -0500
Re: Att:Jolly Roger Re: A program to show all Mac Mail Rules? Jolly Roger <jollyroger@pobox.com> - 2014-12-22 22:35 +0000
csiph-web