• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Select Finder items by Regular Expression
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select Finder items by Regular Expression


  • Subject: Re: Select Finder items by Regular Expression
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 24 Aug 2005 10:35:21 -0700


On Aug 24, 2005, at 10:23 AM, Daniel Jalkut wrote:

tell application "Finder"
    files of entire contents of startup disk whose name contains "Fun" and name extension is "jpg"
end tell

Hi Michelle - I didn't realize that the Finder's built-in matching was as quick and relatively useful as it is. Thanks for that! 

Yup.  Actually I didn't realize it either until I saw your message and decided to try it.

But the big advantage of being able to search by regular _expression_ is that you don't have to write the script every time. You just have to write the _expression_.  I'm not as likely to take the time to write a complete script for a one-off operation like this.

Even though it's a one-liner?

tell application "Finder" to get  files of entire contents of startup disk whose name contains "Fun" and name extension is "jpg"

Or, to use it in a result:

tell application "Finder" to set fun_files to ( files of entire contents of startup disk whose name contains "Fun" and name extension is "jpg")

And it can be saved as a file, and called by "load script" if you wish.

Also, regular expressions make it easy to express more complicated queries like "ends in jpg or jpeg and contain a series of three capital letters followed by a numeral." I'm almost positive you can't put that into words that AppleScript can easily understand.

I think you're right about that.  The nice thing is that Applescript can use regex when it makes sense to use it.

-- Michelle

-- 
Give Peace A Chance.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Select Finder items by Regular Expression (From: Daniel Jalkut <email@hidden>)
 >Re: Select Finder items by Regular Expression (From: Michelle Steiner <email@hidden>)
 >Re: Select Finder items by Regular Expression (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: on idle() handler in script object
  • Next by Date: Re: Select Finder items by Regular Expression
  • Previous by thread: Re: Select Finder items by Regular Expression
  • Next by thread: Re: Select Finder items by Regular Expression
  • Index(es):
    • Date
    • Thread