Re: issues with a find
Re: issues with a find
- Subject: Re: issues with a find
- From: Luther Fuller <email@hidden>
- Date: Mon, 17 Aug 2015 16:36:43 -0500
On Aug 17, 2015, at 3:53 PM, Axel Luttgens wrote: Let’s say I have a file named "aaa.bbb.ccc" on my desktop.
Strictly speaking, a file’s extension is the part of its name that comes after the last dot, if any; in this case, the extension is "ccc".
On the other hand, since you’re scripting the Finder, the relevant property is "name extension", not "extension".
Be careful about extensions. This is NOT necessarily so.
The part of a file name that appears to the right of the right-most dot may or may not be an extension (known as 'name extension' to the Finder.)
I ran this script ...
set fileAlias1 to alias "OS_X:Users:lutherfuller:Desktop:Sums.gcx" set fileAlias2 to alias "OS_X:Users:lutherfuller:Desktop:Sums 2.xyz" tell application "Finder" name extension of fileAlias1 display dialog ((name of fileAlias1) as text) & return & "extension = \"" & the result & "\"" name extension of fileAlias2 display dialog ((name of fileAlias2) as text) & return & "extension = \"" & the result & "\"" end tell
(The file "Sums 2.xyz" is a copy of "Sums.gcx" with the "extension" changed.)
You will clearly see that the file fileAlias2 has no extension because 'xyz' is not a recognized extension.
|
_______________________________________________
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