HOW "Automatically copy selected text to the clipboard."

I do not like to use “command+c” when I want to copy some text or file. I would like the computer execute “command+c” automatically when I select the text or file。

There are some references——
1、AutoCopy – 下载 🦊 Firefox 扩展(zh-CN)


2、https://chromewebstore.google.com/detail/auto-copy/bijpdibkloghppkbmhcklkogpjaenfkg?pli=1

3、CoTS: Copy on Text Selection - Microsoft Edge Addons

Unless I'm missing something, I don't think this is possible—and if it is possible, I'm not sure it's advisable. Your macro would need to be constantly monitoring for a selection, and it would need to be able to tell when you're done selecting—that is, what if you pause while selecting for some amount of time, should the macro process what it sees or keep waiting?

Perhaps someone can think of a creative solution, but that person is not me—I just don't see how this is possible in Keyboard Maestro.

-rob.

This works with my Logitech mouse but I don't see a way to trigger it otherwise. To use it, hold down the ⌘ key and click on the left mouse button to begin your selection. When you release the mouse button, a window will show you what you've just put on the clipboard (if it doesn't, it's because the Copy command isn't enabled in the application).

Because you have to enable the macro with the ⌘ key, it addresses @griffman's sage advice about the advisability of doing this (not advisable) by making it optional.

Copy on Selection.kmmacros (3.4 KB)

What is wrong with him just sending a Copy command to the app (any app, including Finder) every second, and then using the trigger "when the system clipboard changes"? Wouldn't this work?

For a really off the wall solution, if he is willing to use a text browser in a terminal window, (I'm sure he isn't) the copying is done automatically in terminal whenever you select text (that is, using the middle mouse button will copy/paste whatever has been selected.) In fact, you can even multi-select multiple selections in Terminal and it will paste each of them with a single click (separated by a newline.) I didn't know about that until just now.

In macOS, AFAIK, merely making a selection has no effect on the Clipboard, although it may activate the Copy/Cut commands (but not always).

Your experience with Terminal sounds atypical, perhaps a blessing of your third-party mouse software, given that macOS knows nothing about middle mouse buttons, at least.

I see in the OP's post that there is an option to enable the function with a modifier key, which is what I've done and which, I think, makes it safer to employ than a blind function.

I think this is a bad user experience decision unless you are very restrictive about where you apply it.

The main reason it works well inside the document window of "reader" apps like web browsers it because almost the only time you select text is when you want to copy it (and even then you'l see that the plugins have the option to turn off such behaviour in text fields). And if you are going to restrict this to web browsers you may as well use a plugin!

Almost anywhere else it will cause at best confusion (you can never be quite sure what's on the clipboard), or even considerable problems (how do you paste into a field which, like Safari's address bar, auto-selects its contents when you enter it?).

What don't you like about using ⌘-C? If it's the use of the keyboard, how about using the contextual menu via your mouse/trackpad? A button on a programable mouse, as suggested earlier? Or even a foot pedal!

I don't have any third party mouse software. So how does my middle mouse button work in Terminal then? Perhaps it's working because UNIX itself (which the macOS GUI runs upon) supports the middle mouse button. I've been using middle mouse clicks on UNIX shells (including Terminal) as a paste button for many decades (with no mouse drivers) so that's not "atypical."

You should try the middle mouse button in Terminal yourself, to see if it works as I said it does for me.

I don't disagree, as far as the GUI goes, but within Terminal app itself, making a selection could have an effect on its own internal clipboard which you can "paste" into the same app just by using the middle mouse button.

What I'm unable to determine is whether the multi-selection tool inside Terminal is a new feature, or if it has been around for decades.

My Logitech MX Master 3S has the following programmable buttons and a lot of actions that can be assigned to them (including "Copy"):

It's a Terminal thing rather than an all-across-the-OS thing. It also doesn't involve the system clipboard, using whatever is highlighted in the current window or, if nothing is highlighted there, the most recently (and still) highlighted thing in any other Terminal window.

Been around for years, though I think behaviour has changed over time -- IIRC orginally it only worked within a window.

Personally I'd just use drag'n'drop, both within and between apps, if I was using a mouse/trackpad to select and didn't want to use the keyboard. But drag'n'drop seems to be largely ignored since people decided to "improve" their user experience by using full-screen apps, Spaces, etc.

Fun fact though -- you can actually start the drag from app A, ⌘-Tab to app B, complete the drop. I don't know if the same applies to Spaces.

Apple's mouse driver doesn't let you directly set "Copy" or "Paste" on the third button, but you can choose "Other..."

...and "Other..." includes AppleScript applications so you might be able to do something with that. But, this being the KM Forum, it's probably much simpler to use a "USB Devie Key" trigger:

...to fire off a macro. (The mouse driver settings take precedence and "swallow" the click if they are set, so remember to turn that off if you've played with it!)