• 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 13:36:51 -0500

While watching a download, I thought of another useful line of code that should be used here.

tell application "Finder"
set selectionList to the selection as alias list
if (count items of selectionList) ≠ 1 then
beep
return
end if
set selectedItem to (item 1 of selectionList)
if (class of item selectedItem) is alias file then
set selectedItem to (original item of selectedItem) as alias
end if
if (class of item selectedItem) is not folder then
beep
return
end if
--
-- selectedItem is now an alias to a folder
-- do stuff with it here
end tell

Notice that this script allows you to select a single item which must be a folder or an alias file to a folder.

 _______________________________________________
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: get type of selected finder item
      • From: Tobias Exner <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