Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I would like to find a combination of keys to clear the contents of the clipboard or better yet an application that can configure a timer to clear it automatically one minute after last paste operation.

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Yes, you have a choice of three built in methods for clearing the clipboard.

AppleScript/Automator are two simple methods for programmatically manipulating the clipboard.

Here's a little script that does what you want.

tell application "System Events"
    try
        set the clipboard to ""
    on error err_message
        display dialog err_message
    end try
end tell

Also, Automator allows the same. You'll need to define a variable, double click on the name text to set it to null, and then drag in the set clipboard action before running / saving it. The benefit of using automator is that you can assign it as a service and then use system keyboard shortcuts to call it.

screenshot of automator setting the clipboard to null

For AppleScript or one of the nice terminal answers here that use pbpaste you might want to look at a free tool like FastScripts to launch the action from anywhere.

share|improve this answer

To set a combination of keys to clear the clipboard, you can create a Service using Automator.

Your service will have a single action, Run Shell Script

The shell script you will use is this:

 pbcopy </dev/null

enter image description here

Then save the service and assign it a keystroke using System Preferences » Keyboard » Keyboard Shortcuts » Services.

enter image description here

The challenge of an application that automatically clears the clipboard one minute after the last paste operation is that said application would have to monitor all the copy and paste events across all applications; presumably you would want the action cancelled if you pasted and then copied new text (you wouldn't want to clear the new content from the clipboard one minute after the last paste of the previous clipboard contents). Such a program could be written, but implementing it with AppleScript or Automator would be a challenge.

share|improve this answer

This terminal command replaces the clipboard with an empty string:

echo -n '' | pbcopy

You could put this in a script, then use cron or make a launchdaemon to automate the execution and timing.

Credit for the solution goes to: ShadowOfGed @ Applenova Fora

share|improve this answer
    
Running this command via cron and launched would simply make clear the clipboard regularly. –  ephsmith Jun 30 '12 at 17:55
    
if you put it in cron, I'd change it to "echo clipboard flushed | pbcopy" just to remind you what happened when cron flushes the clipboard between copy and paste. :) –  Tim B Apr 17 '13 at 14:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.