Re: Question about "info for" command
Re: Question about "info for" command
- Subject: Re: Question about "info for" command
- From: Nigel Garvey <email@hidden>
- Date: Fri, 15 Jun 2001 11:27:45 +0100
Jan Pieter Kunst wrote on Fri, 15 Jun 2001 00:11:00 +0200:
>
Pier Kuipers (email@hidden) schreef op 14-06-2001 22:49 :
>
>
> I know you're trying to end this thread, but just one last option:
>
>
>
> tell application "Finder"
>
> if last character of ((selection as alias) as text) is ":" then
>
> set IsFolder to true
>
> else
>
> set IsFolder to false
>
> end if
>
> end tell
>
>
>
Nice try ... but that also returns "true" if the selected item is a disk.
As does 'info for'.
A one line, tell-block-less version of the solution given by Chris Page
et alia would be:
folder of (info for the selection of application "Finder")
Ideally, of course, this needs a check to ensure that only one item has
been selected.
With regard to Pier's 'if' block, I hope he won't mind if I point out
that the particular construction:
if proposition then -- proposition is true
set flag to true
else -- proposition is false
set flag to false
end
... can be abbreviated to:
set flag to proposition
So:
tell application "Finder"
set IsFolder to (selection as alias as text) ends with ":"
end tell
The 'as alias' isn't strictly necessary, but as it errors when more than
one item is selected, it makes a good check for this.
NG