Re: Getting file suffix
Re: Getting file suffix
- Subject: Re: Getting file suffix
- From: KOENIG Yvan <email@hidden>
- Date: Tue, 14 Sep 2010 16:55:24 +0200
>
> Le 14 sept. 2010 à 16:39, Ronald Hofmann a écrit :
>
>> This is what I ended up with though, which I think will be safest in all cases:
> What do you mean by this?
> Do you assume the Finder´s 'info for' will some day not work the same way it is doing now???
> But you assume that 'text item delimiters' will always work?
>
> This is strange. Do you distrust functions generally?
> What you do is just a workaround for somebody who doesn´t know the finders 'info for.
>
> On the other hand, your workaround might not work anymore someday when things change.
> But Finder functions will surely adopt to such changes.
>
> Your handler delivers for my artifical file "MacOSX:Users:ronny:Desktop:myFile.honeypot" the extension 'honeypot'. This is the same what the Finder does. What obviously is wrong. May be there is someday a change in MacOSX to recognize correct extensions. But than your handler will still fail while 'info for' will do alright.
>
> My proposal:
>
> set thePath to choose file with prompt "Choose File please..."
> set theSuff to getSuffix(thePath)
>
> on getSuffix(thePath)
> tell application "Finder"
> return (name extension of (info for thePath))
> end tell
> end getSuffix
>
> Greetings, Ronald
> ---
(1) "info for" is not a Finder's function.
so,
> on getSuffix(thePath)
> tell application "Finder"
> return (name extension of (info for thePath))
> end tell
> end getSuffix
is odd.
If you want to use info for, better use it the correct way ;-)
> on getSuffix(thePath)
> return (name extension of (info for thePath))
> end getSuffix
(2) "info for" is a DEPRECATED Standard Addition feature.
So, YES, we must assume that one day it will no longer be available.
Yvan KOENIG (VALLAURIS, France) mardi 14 septembre 2010 16:55:18
_______________________________________________
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