• 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: Getting file suffix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting file suffix


  • Subject: Re: Getting file suffix
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 14 Sep 2010 11:50:10 -0400

On Tue, Sep 14, 2010 at 10:03 AM, LuKreme <email@hidden> wrote:
> I'd actually assumed that the finder extension name would not work since the files I was testing by default were .nzb and .torrent, which I expected were rather non-standard extensions. However, Finder seems to return them just fine.

Not sure what Finder's rules really are, but System Events seems to be
less picky:

set extList to {"txt", "abc", "123", "abc123"}
log("Ext" & tab & "Finder" & tab & "System Events")
repeat with extRef in extList
    set ext to contents of extRef
    set posixPath to "/Users/mreed/foo." & ext
    do shell script "touch " & quoted form of posixPath
    set testFile to POSIX file posixPath as alias
   tell application "Finder"
        set finderExt to the name extension of testFile
   end tell
   tell application "System Events"
        set sysExt to the name extension of testFile
   end tell
   log(ext & tab & finderExt & tab & sysExt)
end

OMM I get this:

Ext     Finder  System Events
txt     txt     txt
abc             abc
123     123     123
abc123          abc123

So the Finder likes "txt" and "123" but not "abc" or "abc123", while
System Events works with any of them.

\
--
Mark J. Reed <email@hidden>
 _______________________________________________
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

References: 
 >Re: Getting file suffix (From: Shane Stanley <email@hidden>)
 >Re: Getting file suffix (From: LuKreme <email@hidden>)
 >Re: Getting file suffix (From: "Mark J. Reed" <email@hidden>)
 >Re: Getting file suffix (From: LuKreme <email@hidden>)

  • Prev by Date: Re: AppleScript-Users Digest, Vol 7, Issue 461
  • Next by Date: Re: Getting the maximum value and minimal values in a list
  • Previous by thread: Re: Getting file suffix
  • Next by thread: Re: Getting file suffix
  • Index(es):
    • Date
    • Thread