on foo() tell application "Finder" set someFolder to choose folder set aList to name of files of someFolder as list set AppleScript's text item delimiters to return return ".scpt" is in (aList & return as text) end tell end foo on run {} foo() end run