• 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: RegExps in AS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegExps in AS


  • Subject: Re: RegExps in AS
  • From: Nigel Smith <email@hidden>
  • Date: Tue, 22 Feb 2005 13:13:13 +0000

On 20/2/05 17:35, "Ihar 'Philips' Filipau" <email@hidden> wrote:

>  How do you people do in AS simple things like: strip extension (if
> file has one), strip directories from path name (if there anything to
> strip), extract extension (if name has one), extract path name (if name
> has one), etc.

A lot of this depends on how you are presenting the input -- whether if is a
file reference, a text list of Apple- or Unix-style paths, and so on. As
others have said, you need to say more about what you are trying to do.

In the meantime, and just to show there are many ways to skin this
particular cat, here's a way to get "filename-without-extension":

    set theFile to (choose file)
    set tmp to (reverse of (every character of (get name of (info for
            theFile)))) as text
    return (reverse of every character of (get text ((offset of
            "." in tmp) + 1) thru -1 of tmp)) as text

Hey -- I never said it was a *good* way :-)

    Nigel

 _______________________________________________
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: 
 >RegExps in AS (From: "Ihar 'Philips' Filipau" <email@hidden>)

  • Prev by Date: Getting missing font info in XPress
  • Next by Date: Re: "Couldn't save document"
  • Previous by thread: Re: RegExps in AS
  • Next by thread: Re: RegExps in AS
  • Index(es):
    • Date
    • Thread