• 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: wildcard for directory selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wildcard for directory selection


  • Subject: Re: wildcard for directory selection
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 8 Jul 2003 11:42:09 -0700

On Tuesday, July 8, 2003, at 8:49 AM, Matthew Galaher wrote:

I wish to be able to type the first x number of characters in a file name in a dialog, and then have the finder select/open the first match. So if I have directories named:

Volumes/Production/client/content/0073_foobar
Volumes/Production/client/content/0074_barfoo
Volumes/Production/client/content/0075_foobar

the dilalog would only need '0075' to open directory 0075_foobar

Is this something that would be best to have Applescript talking to terminal.app?

That's one way. The more normal way, from AppleScript's point of view, is to use the Finder's object model of the file system:

-- get the prefix from the user
display dialog "Give me a prefix:" default answer "0075"
set p to text returned of the result

-- the business end.
tell application "Finder"
open first item of folder "Production:client:content:" whose name starts with p
end

If you wanted to restrict it to files, say "first file" instead of "first item."


--Chris Nebel
Apple Development Tools
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: wildcard for directory selection
      • From: Matthew Galaher <email@hidden>
References: 
 >wildcard for directory selection (From: Matthew Galaher <email@hidden>)

  • Prev by Date: Re: wildcard for directory selection
  • Next by Date: Re: Get a list of applications
  • Previous by thread: Re: wildcard for directory selection
  • Next by thread: Re: wildcard for directory selection
  • Index(es):
    • Date
    • Thread