• 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: Where is Trash Folder(?)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is Trash Folder(?)?


  • Subject: Re: Where is Trash Folder(?)?
  • From: Lists <email@hidden>
  • Date: Sat, 26 Sep 2015 11:38:13 -0700


On Sep 26, 2015, at 11:19 AM, Robert Poland <email@hidden> wrote:


On Sep 26, 2015, at 11:41:AM, Yvan KOENIG <email@hidden> wrote:


Le 2015/09/26 à 19:34, Robert Poland <email@hidden> a écrit :

Hi,

I’m trying to create a script, below, that I can add to a Keyboard Maestro shortcut. This script works with normal folders but “Trash” doesn’t seem to have a home.

Any thoughts/suggestions?

(* openTrashContainer - 9/26/15 - By R L Poland
*)

tell application "Finder"
activate
set TrashFolder to (path to Trash folder)
set windowList to name of Finder windows as text
# display dialog windowList
if windowList contains "Trash" then
close window "Trash"
else
open folder TrashFolder
end if
end tell

TIA,



(1) path to is not a Finder command but a Standard Additions one.


(2) It seems that you failed top look in Standard Additions dictionary.

There is no "path to trash folder" command, just a "path to trash" one.

Taking care of that, it's easy to build a script which behave flawlessly.

set TrashFolder to (path to trash)
tell application "Finder"
activate

set windowList to name of Finder windows as text
# display dialog windowList
if windowList contains "Trash" then
close window "Trash"
else
open folder TrashFolder
end if
end tell



Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) samedi 26 septembre 2015 19:41:13

I keep getting the error
"Result:
error "Finder got an error: Can’t make alias \"Macintosh HD:Users:rpoland:.Trash:\" into type folder." number -1700 from alias "Macintosh HD:Users:rpoland:.Trash:” to folder“

Robert Poland
Fort Collins, CO

try replacing this line
open folder TrashFolder

with

open TrashFolder

J
 _______________________________________________
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: 
 >Where is Trash Folder(?)? (From: Robert Poland <email@hidden>)
 >Re: Where is Trash Folder(?)? (From: Yvan KOENIG <email@hidden>)
 >Re: Where is Trash Folder(?)? (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Where is Trash Folder(?)?
  • Next by Date: Re: Where is Trash Folder(?)?
  • Previous by thread: Re: Where is Trash Folder(?)?
  • Next by thread: Re: Where is Trash Folder(?)?
  • Index(es):
    • Date
    • Thread