• 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
Rép: Simple newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rép: Simple newbie question


  • Subject: Rép: Simple newbie question
  • From: Yvan KOENIG <email@hidden>
  • Date: Thu, 18 Jun 2009 22:11:49 +0200

Le 18 juin 2009 à 20:14, Christopher Nebel a écrit :

On Jun 17, 2009, at 1:17 PM, Peter Robertson wrote:

How can I get just the name of a file without the extension? If I use

set theName to (text 1 thru ¬
            (offset of "." in theFile) of theFile)

with say file '123.jpg' I get '123.' I want just 123 without the "."

Various people have shown different ways of munging the full name string (though no one has suggested using basename(1) yet...), but to elaborate on what Finder itself offers, there are three different properties in Finder relating to the "name" of a file:


name: the name as it appears in the file system, always including the extension.
displayed name: the name as it appears in Finder, taking the "hide extension" settings into account.
name extension: just the extension, if any.


Bear in mind that Finder's idea of an "extension" is based on Launch Services and what extensions have been registered by applications on your system, not just whatever comes after the last dot in the name. For example, if you ask what the "name extension" is of a file named "foo.potrzebie", you'll get "".


Curious.
Here is a log report:
tell application "Finder"
get name extension of alias "Macintosh HD:Users:yvan_koenig:Desktop: 4bugHunters - c.yvankoenigineok"
"yvankoenigineok"
end tell


I would be surprised if you may confirm that "yvankoenigineok" is a valid name extension ;-)

Yvan KOENIG (from FRANCE jeudi 18 juin 2009 22:09:12)






_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Prev by Date: Re: Simple newbie question
  • Next by Date: Re: Simple newbie question
  • Previous by thread: Re: Quit running Applescript
  • Next by thread: Getting files/folders by creation date in the Finder
  • Index(es):
    • Date
    • Thread