Clipboard action not working

I have a clipboard action that I use to copy information from an application called Papers that I use to my primary writing application (sublime text). For some reason it just completely stopped working. When I paste the results of this into sublime, I only get the results of typing option+cmd+M (one of the later steps), and without even the search and replace that comes after it.

I'm not sure if the problem is the search and replace or something. But I know that this used to work before, and all the settings are still right.

Any suggestions would be greatly appreciated!

Hey Menel,

Post the actual macro and not just an image of it.

See Using the Keyboard Maestro Forum.

That makes it easier to troubleshoot.

You’re starting in Sublime or Papers?

-Chris

I apologize here it is.

To be more precise, in Papers, if I copy highlighted text it comes along with some extra information that I don't want. For example: p.114: copied text in here -- Highlighted Nov 28, 2015

The point of the macro is to filter out the page number and highlighted date, add quotes to either end, and add the citation information (formatted the way I want). So it would look like this: "copied text in here"[@citation 14] I start in papers, press the hot key, and then switch to sublime and paste in the correctly formatted text.

As you can see, I actually changed the macro slightly to filter a variable rather than the keyboard, but it still doesn't work.

It was definitely working at some point, I've used it many times, but for some reason it stopped.

Thanks for the help!

Copy as quote.kmmacros (7.3 KB)

Hi could you try this because once I changed the regular expression format for

It seemed to work fine. Also the member ccstone that has already commented on this topic might be able to suggest how this can run via Apple script. I mention this because he has shown me some ways to work with what I had constructed with steps, and it is no comparison how well they run as Apple Script. I am curious to see how a Keyboard Maestro macro with user input like yours will team up with Apple Script. Also I changed the hot key on my system, change it back to what you want to test

Copy as quote Test.kmmacros (7.3 KB)

I tested your version but it’s still not working properly. Sometimes I get just the cite key, sometimes only what I had copied previously–almost like it never recognized the original copy command.

Could it have to do with just having too many steps? I tried inserting pauses between everything to spread it out, but no luck.

Hi, is it possible that you could give a sample of the document in Papers that you are copying from? This way I could try to reproduce the problem? Also is it possible that you have another application on your system that is “eat”-ing the copy keyboard short cut? This means that there is some type of conflict where another application is getting the keys pressed and using them for itself, therefor the application you want to get the (in this case) copy is missing it. Play around with the hot key in Keyboard Maestro and see if your result changes. I say that because it is very close to copy (Command C), which makes me think about other application that use copy in there own way (I have a few on my system).

Sure here’s a page of the PDF I’m currently working in. However the problem persists no matter what PDF I’m copying from.

Just a reminder, the macro work specifically on text that’s been highlighted in Papers…

Thanks for your help.

Hi, I was under the impression (from the design of you macro) that the text “-- Highlighted Nov 28, 2015” with a variable date was always in your copied text. If not that may just be the problem. You have an entry look for that specific text format in you macro. Look at your 6th part of your macro in picture. Maybe that is where your unexpected result is coming from? What is your desired selection constant with, meaning what is always selected?

When something is highlighted in papers and then copied it always comes along with a page number and a highlighted date, as in, p.114: copied text in here -- Highlighted Nov 28, 2015. When text isn’t highlighted it just copies the plain text. Most of the time, however, if I’m copying from papers it will be highlighted text, that’s why I designed the macro like this.

In the version of Papers it does not seem to do that. When I highlight a piece of text and press Command C I don’t get the format you describe.

I'm not sure why. Are we doing the same thing? Here's a screenshot showing a piece of highlighted text from the PDF I sent. When I click cmd+c I get this: p.120: If Levinas proposes that the temptation of autonomous philosophy must be avoided, he also provides a way for negotiating the dangers of revealed command morality. -- Highlighted Nov 29, 2015

However, either way, even without the highlighted date, the macro isn't working. For example, if I try and use it on text that isn't highlighted, I should get something like this: copied text here [@citation 14] The only thing that's different is that I wouldn't get the quotes on either side of the copied text, because those are inserted only by searching and replacing the highlighted date and page number. When I run right now on unhighlighted text I get: date[@Fagenblat:2008gd 119] This is essentially my last copied item, date, and then the citation key. I have no idea why it grabs the citation key but not the proper text.

Maybe it would work better if this was somehow changed into an applescript, I just don't know how to do that. Any ideas?

Good, I see what you mean, I have never used Papers before. I was just selecting text, I see the yellow signification of “highlighted”. It does give me what you describe. Got it! I will continue to test with this… Let me see?

1 Like

Hi, when testing what it does perform like you say, I mean once you showed how to get the actual highlight I had the same problem you described. I changed the macro to focus back to Papers and it seems to be working now. For me it does the steps you seem to want. I know this because it appends the same result as Alt + Command + M to the text with an @ in the brackets. Let me know?
Copy as quote Test2.kmmacros (8.2 KB)

No luck. Still having the same problem. I get the citation information properly formatted but the original copied text doesn’t show up. So I’m getting something like this: information[@Fagenblat:2008gd 113] In this case information was a word I had just copied before invoking the macro. You can see it gives me the proper citation, but is still not picking up the clipboard.

What’s really interesting is that when I pull up my clipboard history (I use Launchbar), I can see the original copied text. Which means that the text is copying to the clipboard, but for some reason keyboard maestro isn’t reading it.

ok quick update, if I put a half second pause immediately after the copy action it sometimes works. Which seems to mean that keyboard maestro just can’t process this fast enough? Which again leads me to wonder if some version of an applescript couldn’t do this better?

This is interesting. As for a function of the macro (respectively) it does exactly what you want for me. I say that because when is use the keyboard hot key in Papers which I see is Option+Command+M I get this {Hall:2014db} I don’t know what the db is but that is what I get. It is the same thing that I get at end of Keyboard Maestros work with the “highlighted text”[@Hall:2014db 10] If the page number I input is 10. So for me the macro is doing what is told.

Which seems to mean that keyboard maestro just can't process this fast enough?

No, I think probably the converse. Keyboard Maestro is likely to be going faster than the app.

(It samples the clipboard before Papers has got around to updating it.)

I think you may just have to slow down Keyboard Maestro to wait patiently for Papers, possibly using a 'wait until' condition of some kind:

Great point!

Ok I tried that, I inserted a Paul Until the clipboard contains -- Highlighted but I still get all sorts of weird variations. Sometimes I get something like this: -- Highlightedp.179: copied text here. -- Highlighted Jan 24, 2015 12] (which is of course totally wrong). Sometimes I get just the citation information not even properly formatted, like this: {Levinas:1990tv}

Really not sure what the problem is at this point

I would start with a very generous pause of N seconds, and then once it's working reduce it to whatever turns out to be a safe margin.

Papers may well be quite slow to write the clipboard.

1 Like