Mailsmith
Other Programs
Scripts
Mailsmith.scpt
Archive to sub-mailbox
Check Spelling
Find reply
Change font size
Submit Script to JEM
Fix common spelling errors
Setting SMTP server
URL from Safari
Address from AB
linkMunge
Export to Address Book
Saving attachments
Digest Script
File with same
POP window position
Position of new windows
iCal and Mailsmith
Edit From Line
Modified Thread Script
Reply to Selection
Temporary Text Window
Compact gain
Tracking backups
Edit subject
Googler
Auto-rewrap
MMA
SMTP server
Open, fetch, and close
URL Manager
BrainForest
Thread by Author
Thread by subject
Export Email
Get Selection
Read Addresses
Export Email
Organize Email
Account setup
Mailsmith 2 BBEdit
BBEdit 2 Mailsmith
Search II
Check One
Delete Enclosure
Open, fetch, close
Set Answered
Set Redirected
Empty Trash
List found
Print Several
Del. old. msg.
Delete Enclosures
Accounts
Address Book
Editing
Filters
General
Import/Export
Links
Mailboxes
Memory
Scripting
Speed
send/receive
Tips/Tricks


Using Mailsmith to keep tracks of backups

Author Peter Boardman
Last modified 2002-11-22
What is this?

Perhaps you've got room for this eccentric tip.

Strangely, I find Mailsmith useful for keeping a record of my CD backups. Well, why not?! Mailsmith is always open, has good scripting and search tools, its data gets backed up by Backup, and anyway I don't own BBEdit...

Basically, all I do is create a new message, then drag the CD into the body area. Mailsmith obligingly lists the whole lot for me.

But then I also - usually - run a script on this window that tidies up the results to taste. This strips out highly nested files (to a level that suits me at the time) and changes the file names to use "/" rather than ":". :-)

Then it can stay in a "Backups" mailbox.

tell application "Mailsmith 1.5"
    activate
    
    -- strip out lines with lots of tabs (= levels of file hierarchy)
    set str to ""
    set level to text returned of (display dialog "levels to show?" default answer 5)
    repeat level times
        set str to str & "\\t"
    end repeat
    
    -- now remove lines containing these tabs 
    set pattern to "(" & str & ").*\\r" as string
    
    set search_opts to ¬
        {search mode:grep, starting at top:true, wrap around:false, reverse:false, case sensitive:false, match words:false, extend selection:false}

    replace pattern using "" searching in text 1 of front window options search_opts
    
    -- remove hidden files, they're not very interesting
    replace "\\t\\.(.*)" using "" searching in text 1 of front window options search_opts
    
    -- remove blank lines
    replace "^$\\r" using "" searching in text 1 of front window options search_opts
    
    -- replace colons with slashes - like UNIX!
    replace ":" using "/" searching in text 1 of front window options search_opts
    
    -- make a subject
    -- Since I use Backup, the 26 characters are just right.
    set t to (text 1 of front window) as string
    set t to characters 1 through 26 of t as string
    set subject of front window to t
end tell