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


Search Mailboxes II

Author Christian Smith
Last modified 1999-02-14
What is this?
What is the syntax to search all mailboxes for any messages whose label is "Some Label" and then open a message list window with those messages. (A Query Results window would, of course, be much nicer.) I've tried what seemed obvious to me (but I won't show it so I won't be ridiculed ;-)), but it didn't work.
You can't. At present, you need to loop over all mailboxes and run the query for each mailbox. You will end up with a search results window for each mailbox. The other would be nice, but you cannot do it at present. Here is an example ... [deleted]

Here is a slightly modified version of Jim's script which opens up a new query results window for each mailbox that has unread messages showing only the unread messages.


on run
    tell application "Mailsmith 1.1"
        set ct to count mailboxes
        repeat with i from 1 to ct
            set obj to mailbox i
            my process_mailbox(obj)
        end repeat
    end tell
end run

on process_mailbox(mbox)
    tell application "Mailsmith 1.1"
        set n to name of mbox
        if (exists (messages of mbox whose seen is false)) then
            set the_name to "Unread messages: " & n
            make new mail list window with properties {name:the_name} with data (messages of mbox whose seen is false)
        end if
        set ct to count mailboxes of mbox
        repeat with i from 1 to ct
            set obj to mailbox i of mbox
            my process_mailbox(obj)
        end repeat
    end tell
end process_mailbox