# Using Pick

Let's take another look at the `Pick` command on the `Sequence` menu. (The Section Searching for Messages introduced `Pick`.) It lets you search for messages by any field in the header, any word(s) in the body, or a combination of these. It's a flexible and powerful way to find messages.

## A Pick Example

When you use `Pick`, a window like the Figure below opens (by default, it's on top of the main xmh window; I've moved it to the side so you can see both).

To select messages, point to one of the boxes by a field name and type what you want to search for. For example, to find messages from nathan, point to the `From:` box and type `nathan`.

Figure: Main and Pick windows

In the Figure above, I wanted to find messages which were sent to either the mh-users or mh-workers mailing lists). I pointed to the `To:` box and typed `mh-users`. Then, I clicked the `Or` button next to the window; another box opened, where I typed `mh-workers`. Because I left the other boxes blank, `Pick` ignored those fields. If I had filled in one (or more) of them, `Pick` would have found only messages that fit all the criteria -- for instance, if I had also put the word `bug` in the `Search:` box, `Pick` would have selected only messages to mh-users or mh-workers which contained the word "bug."

Remember that, in some cases, messages may be sent to an address via the `To:` field or the `cc:` field. You wouldn't want to type those addresses in the `Cc:` boxes of the Figure above, though, because the address would have to be listed in both the `To:` and `cc:` fields to be matched. In this case, you want the "big `-Or-`" button.

By default, the `Pick` window creates a sequence named `temp`. That sequence is normally reused each time you use `Pick`. Because I want to keep this sequence for awhile, I changed its name to `mailquestions`.

Sequence names can be alphabetic characters (letters) only -- if you use an invalid name, xmh won't define the sequence; you'll see a dialog box with an error from the MH pick command.

When I click `OK`, the `Pick` window closes. The main window's Table of Contents title changes to `project:mailquestions`, and the list shows the messages in the sequence. There'll also be an entry on the `Sequence` menu for the `mailquestions` sequence. See the Figure below.

Figure: Main window after picking mailquestions sequence

When you're done looking at the sequence, you can select another existing sequence by selecting the name on the `Sequence` menu, then using `Open Sequence`. The `mailquestions` sequence entry will remain, and MH will "remember" the messages in the sequence. Or, you can add and delete messages from a sequence -- see the Section Modifying Sequences.

## Using the Big -Or- Button

`Pick` lets you make much more complicated searches. For example, to find messages from john to alison or from mona to zelda (but not from john to zelda or mona to alison), you would use the big `-Or-` button at the lower-left corner of the `Pick` area. This makes a duplicate of all the `From:`, `To:`, etc. boxes below the first set and puts scrollbars on the area. I've filled in the names. The Figure below shows this (I've dragged down the grip to show the important parts).

Figure: Pick window after big -Or- clicked in top area

## Find Other Fields, Skip Fields

The `Pick` and `Skip` buttons choose whether messages should or should not match the search string you type. All the examples so far have used the `Pick` buttons. But if you click the `Skip` button next to a field, it tells xmh to find messages which do not match that field.

The box with a blank field name lets you specify another header field besides `From:`, `To:`, and so on. For instance, to search for all messages which had the following field:

        Reply-To: jerryu

in the header, you'd fill in the blank field-name box as shown in the Figure below. (These messages might be ones that jerryu sent from angelac's account.) The window in that figure would match all messages from the angelac account that have a `Reply-to: jerryu` field in the header -- except messages sent on January 24, 1993.

Figure: Example of Pick skip button

Unfortunately, the format of the date you type in the `Date:` box must match the message exactly. (The `Date range:` boxes don't have this problem.) As we get closer to the year 2000, more mailers are converting from the old two-digit year format (like `93` for 1993) to using all four digits. So, if you can't use the `Date range:` boxes, it's safest to type the date with both formats. I did that in the Figure above.

## Bottom Area of the Pick Window

The bottom area of the `Pick` window isn't used too often, but it's good to know about. Here are some of its features:

- The `Creating sequence:` box lets you choose the sequence name `Pick` should write. It defaults to temp. xmh will empty an existing sequence unless you tell it not to. If you want to preserve the messages that are in the sequence and add the new messages to it, be sure you've clicked `No` next to `Clear old entries from sequence?`. It's not a good idea to choose a new sequence name each time you use `Pick` because you can't have more than 26 sequences defined per folder. Sequence names must be alphabetic; uppercase and lowercase letters are distinct, so the sequence named Temp would be different than the one named temp.
- The `with msgs from sequence:` box tells `Pick` which message sequence to search for the messages you're picking. This is set automatically to the same sequence that was selected in the main window before you started `Pick`. Usually, you'll set this to search `all` messages, but a name besides `all` can make the search go faster because there'll be fewer messages to search.
- The `Date range:` boxes take a starting and ending date to search. `Pick` ignores messages not sent between these two dates. Unfortunately, filling in dates doesn't make the search more efficient, because `Pick` still has to search all the messages to find what date each one was sent. If the `Date field:` is empty, `Pick` gets the date from the `Date:` field in each message header. That's usually what you want. But you can change it to use, say, `Delivery-Date:`, if your mail is processed through the MH slocal program.

xmh will put a horizontal scrollbar above this area if it's too wide to fit in the window.