Paste Selection Into Last chrome window

I found the included macro 'Paste Selection Into Last Application' and it works perfectly between two applications. for example copying data from a PDF in adobe to chrome. I click the empty box in chrome, select the text in adobe, activate the macro and it auto selects chrome and pastes text.

my issue is that it does not work with two different chrome windows open. I often have two windows open from two different chrome profiles. I have tried all the available chrome variable and substituting them into the included macro and can't seem to find a variable that works. I'm looking for a 'Last active window' variable and it doesn't seem to exist.

Please advise as to how. I can make this work. I believe this will help a lot of people as well.

picture is of the working Macro I am trying to modify for my needs.
Screen Shot 2023-11-14 at 5.06.03 PM

Thank you

If you are able to put both tabs in the same window, (I'm not sure if you are) you could probably do this:

If you are able to put both windows on two specific/known parts of the screen (eg, left half, right half) you could use a Click Mouse action on the title bar of the other window to activate them.

image

There very well could be even better solutions, (I wouldn't be surprised) but I'm sure the second idea would work. Since I'm the first person to reply, I'm allowed to give imperfect solutions :slight_smile:

Hey, that is a great idea that works better than nothing. I have been testing it this morning in my workflow for a few hours. But it requires consistency from workflow. I don't always copy from my left monitor to my right one or vice versa.

It is working if I have 2 full screen browser tabs on different windows and I want to copy from the left screen to the right. KM moves the mouse 1920(my monitor width) clicks, paste, and moves mouse back to previous spot.

I'm looking for something a little bit more fluid.
Screen Shot 2023-11-15 at 1.27.33 PM

Thank you,

Assuming the two windows are the two most recently activated, I think this will work reliably:

Copy and Paste across windows.kmmacros (2.8 KB)

Macro image

Keyboard Maestro Export

From Apple support:

Command–Grave accent (`): Activate the next open window in the front app.

Shift–Command–Grave accent (`): Activate the previous open window in the front app.

...(The character on the second key varies by keyboard. It's generally the key above the Tab key and to the left of the number 1.)

If instead you're working with two arbitrary windows that aren't necessarily the two most recently activated, we will have to work out something more complicated, likely using AppleScript.

1 Like

This absolutely works for my use case. Not at all how I thought i should do it. lol. I also learned about two new keyboard commands!

Thank you for your help.