Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7995021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:17:11+00:00 2026-06-04T14:17:11+00:00

My goal is to make the Delete key (without any modifiers) move selected files

  • 0

My goal is to make the Delete key (without any modifiers) move selected files to the trash using OSX’s Finder, similar to Windows Explorer. I’ve managed to do it using a great utility application called Spark. Spark allows me to assign the Delete key to do something when in Finder only. I can have it type the Finder shortcut key (command-backspace), or activate the File > Move to Trash menu item, or run an AppleScript. In each case, the file is moved to the trash successfully. It works well … a little too well.

If I’m in the process of renaming a file and press the Delete key, the file is moved to the trash instead of the letter ahead of the cursor being removed. I can’t think of any clever way of working around the problem. The only thing I can think of is to use AppleScript to determine if the text editor is open in Finder in order for the user to rename a file … or, simply put, determine if the user is renaming a file in AppleScript. Something tells me this goes beyond the capabilities of AppleScript. Can it be done? Any other suggestions would be most welcome. Thanks.

UPDATE:

Thanks to adayzdone, I have a working script now. Create a hotkey for Finder in Spark, assign the Delete key to it, and use this script as the action:

tell application "System Events"
    tell process "Finder"
        if not (exists text field 1) then
            tell menu bar 1
                tell menu bar item "File"
                    tell menu "File"
                        click menu item "Move to Trash"
                    end tell
                end tell
            end tell
        end if
    end tell
end tell

UPDATE 2:

Here’s an updated script based on adayzdone’s cleaner version. I added a line to reissue the delete key when you’re renaming a file and press delete. It has a problem though: you have to press the delete key twice for every one character removed. Also, you can leave things in a weird state when done renaming the file: if you press delete to remove a file, it might not work … requiring a second key press of delete before things return to normal. I think the problem is from issuing the delete key from within the event being handled by Spark. I’ll try to find a solution.

tell application "System Events"
    tell process "Finder"
        if exists text field 1 then
            keystroke "d" using {control down}
        else
            click menu item "Move to Trash" of menu 1 of menu bar item "File" of menu bar 1
        end if
    end tell
end tell
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:17:13+00:00Added an answer on June 4, 2026 at 2:17 pm

    Try:

        tell application "System Events"
        tell process "Finder"
            if not (exists text field 1) then click menu item "Move to Trash" of menu 1 of menu bar item "File" of menu bar 1
        end tell
    end tell
    

    Another approach is:

           tell application "Finder"
        if selection is not {} then
            tell application "System Events" to tell process "Finder"
                if (exists text field 1) then
                    keystroke (ASCII character 8)
                else
                    tell application "Finder" to delete selection
                end if
            end tell
        end if
    end tell
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using HTML5 offline storage. The goal is to make the whole site
My goal is to make the second div take as much space as it
My goal is to make 3 apks (for a very specific solution, not for
My goal is to make a layout that is 200% width and height, with
My end goal is to make node.js more cost effective per each server instance.
I'm basically trying to make a goal bar. The goal is determined by getting
My goal here is to make a button. I want the text to sit
I'm re-writing alibrary with a mandate to make it totally allocation free. The goal
Goal: Make it possible to decorate class methods. When a class method gets decorated,
Goal: Make a decorator which can modify the scope that it is used in.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.