• 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: whose class is folder...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: whose class is folder...


  • Subject: Re: whose class is folder...
  • From: Jean-Christophe Helary <email@hidden>
  • Date: Sat, 07 Apr 2018 12:16:13 +0900

I have something that should be translator proof :)

tell application "Finder"
        set myClasses to {folder, application file, package}
        set mySelection to (selection as list)
        set selectedFolders to {}
        repeat with thisItem in mySelection
                if class of thisItem is alias file then
                        set thisItem to original item of thisItem
                end if
                if class of thisItem is in myClasses then set the end of
selectedFolders to thisItem as alias
        end repeat
end tell
return selectedFolders

The only problem is for document files that *are* packages (ie plain folders)
but that are declared as document files... If I were only looking for folders
(like I was before being tickled by that whose thing) that would be even easier.

Thank you all for your insights.

Jean-Christophe

> On Apr 7, 2018, at 9:47, Stockly, Ed <email@hidden> wrote:
>
> Let me save you some time and frustration:
>
> tell application "Finder"
> set myFinderItems to the selection as alias list
> set selectedFolders to {}
> repeat with thisItem in myFinderItems
> if the kind of thisItem is "folder" then
> set the end of selectedFolders to thisItem as alias
> end if
> end repeat
> end tell
> return selectedFolders
>
>  Past that into your script; drop it into a handler and go on to the next
> issue.
>
> I've banged my head on the same wall, to no avail.
>

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune


 _______________________________________________
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

  • Follow-Ups:
    • Re: whose class is folder...
      • From: Christopher Stone <email@hidden>
References: 
 >whose class is folder... (From: Jean-Christophe Helary <email@hidden>)
 >Re: whose class is folder... (From: Shane Stanley <email@hidden>)
 >Re: whose class is folder... (From: Jean-Christophe Helary <email@hidden>)
 >Re: whose class is folder... (From: Shane Stanley <email@hidden>)
 >Re: whose class is folder... (From: Jean-Christophe Helary <email@hidden>)
 >Re: whose class is folder... (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Display the state of a process
  • Next by Date: Re: Display the state of a process
  • Previous by thread: Re: whose class is folder...
  • Next by thread: Re: whose class is folder...
  • Index(es):
    • Date
    • Thread