Syntaxset mybool to ({"apples","oranges","peaches"} contains "peaches") (* returns true *) Return valueboolean; true or false DescriptionThe contains operator can take lists, records, or strings as operands. You can use this operator to search for an item in a list, a record, or a part of the string. If the operand to the right of the contains operator is of a different type than the left operand, then AppleScript attempts to coerce the second operand to the class of the first one. This is an operator to get to know well. A lot of commands return lists, strings, and records; contains is a very useful tool for finding certain values within these value types. You cannot use contains directly to search the contents of a folder, but there is a workaround for this task. The example in this section illustrates returning a list with a command and then using the contains operator to search the list. You can use contains to search a record too: {name:"Bruce W.", state:"MA"} contains {name:"Bruce W."} Examplestell application "Finder" tell folder "new images" set fJpgs to files whose name contains ".jpg" (* returns list of jpeg files, if any *) if length of fJpgs > 0 then (* if the list is not empty then display count of jpegs *) display dialog ((length of fJpgs) as string) end if end tell end tell |