• 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: get type of selected finder item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get type of selected finder item


  • Subject: Re: get type of selected finder item
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 23 Apr 2009 10:54:28 -0500

On Apr 23, 2009, at 10:33 AM, Tobias Exner wrote:
I'm searching through the web since some hours but can't find any solution... so I'm going to post it here.

In a little applescript I want to use a selected file or folder from finder.
That's quite easy:

    tell application "Finder"
        set this_item to the selection as alias
        display dialog this_item as string
    end tell

but I want to know if the selected item is a file or a folder. Depending on this info the script would work in another way.

You need to test the selection to see if it contains just one item and that item is a folder. Run this ...

tell application "Finder"
set selectionList to the selection as alias list
repeat with itemAlias in selectionList
if (class of item itemAlias) is folder then
beep
delay 1
end if
end repeat
end tell


The '... as alias list' is necessary. Without it, the selectionList contains references. Aliases are easier to work with.

 _______________________________________________
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

References: 
 >get type of selected finder item (From: Tobias Exner <email@hidden>)

  • Prev by Date: Re: get type of selected finder item
  • Next by Date: Re: get type of selected finder item
  • Previous by thread: Re: get type of selected finder item
  • Next by thread: Re: get type of selected finder item
  • Index(es):
    • Date
    • Thread