Re: Getting file suffix
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