How to keep Clipboard History window active after pasting

If I select a clipboard in Clipboard History after triggering Activate Clipboard History using a key press then paste the selected clipboard using Return, the Clipboard History window remains open but inactive. How can I either make it stay active after the paste, or reactivate it with the same key press? Right now the key trigger always toggles the Clipboard History window, even if it is inactive, and I want the trigger to always activate it. I’d prefer to close it some other way besides pressing the activation trigger again. Thanks.

Maybe that first question should read, “How can I either make it automatically activate after the paste, or reactivate with the same key press”?

It has to deactivate in order for the paste to go to the target application - if it stayed active, then the Paste would go to the Clipboard History window which would not be useful.

It can’t activate afterwards, since it does not know how long it needs to wait until the application has processed the Paste.

You can control whether the window closes after you paste or not using the Close After Action toggle button at the top.

There is no way to make the trigger activate it instead of closing it if it is not active. Maybe that should be the behaviour, but in many cases you want to use it and then close it, so it’s not clear that would be a better behaviour in general.

The simplest solution is to just press the trigger twice to close and reopen it.

OK, thanks. I just wanted to make sure I hadn’t missed something simple (which I did, namely the close after action toggle button). Is there an action (or sequence of actions) that can determine whether the window is active or inactive after determining that it exists?

I’m trying to work around my issue by making Keyboard Maestro perform a “while” action through which it will activate the Clipboard History Switcher, but if I tell it “while any window title of KM contains Clipboard History Switcher” the condition is always false. In what way can I test for the existence of the window for a “while” or other repeat action? I would like to tell Keyboard Maestro to make the Clipboard History Switcher window active at timed intervals whenever it exists.

I meant to add that when triggered the window activation “while” action waits for the return key which pastes the chosen clipboard.

You can use AppleScript to test for the switcher window's presence like this:

17 PM

tell application "System Events"
	tell application process "Keyboard Maestro Engine"
		window "Clipboard History Switcher" is visible
	end tell
end tell

Thanks, gglick. The script works great, but now I’m facing the same problem activating the window. Nothing happens upon running

tell application "System Events"
	tell application process "Keyboard Maestro Engine"
        activate
		tell window "Clipboard History Switcher" to activate
	end tell
end tell

Do you know how to get that window to come to the from using a script or an action in KM?

Thanks again.

No problem, @Lantro. Any reason the built-in KM action to activate the switcher wouldn't work here?

50 PM

Thanks, gglick. The script works great, but now I'm facing the same problem activating the window. I thought that I might be able to create a loop macro with another activate clipboard history action, but I haven't yet found a way to make the window come to the front except by clicking it. I thought that it might possibly close instead of coming to the front, because that's what triggering the activate clipboard history action does otherwise if the window is open. Is there any way whatsoever to move that window from background to foreground other than to click it?
reactivate-clipboard-history

Yup. Just use its activate action twice:

39 AM

Alternatively, you might look into other clipboard history apps, like Copied. KM's is of course great, but I personally use Copied as my primary clipboard history manager, and it can be easily configured to stay open after a paste action.

Thanks. That makes it work the way I had hoped for it to. I still need to play with it some to see whether making it wait for the return keystroke is beneficial.

I normally use my clipboard stack (video), but I sometimes need more robust clip flavor handling. I sometimes use an app called Clipboard History that I acquired for free a long time ago when the MAS was young.

1 Like

Is there any way to actuate the Close After Action button without using the mouse?

Hey Michael,

The button with the Phillips screw head looking icon:

28

-Chris

Yes I know. How do I click it without the mouse? Do I need to set up a click found image action? Will that even work?

Thanks

Michael L. Grant, CGBP

Hey Michael,

Boy did I misread your OP... You were quite clear.

Yes, it can be done – although it's not straightforward unless you know AppleScript UI-Scripting.

The macro is just an example of how to do it. I wouldn't think you'd want that as the default behavior.

It's possible to detect whether or not the button is already pressed, so you can make decisions in your script.

-Chris


Activate Clipboard History Switcher.kmmacros (5.8 KB)

Nice, thanks!

Michael