How Can an App Send All Data to a KM Named Clipboard?

I am using a lot of different macros to recognize text from my screen.
I use an application that sends text to clipboard once recognized
I want it to save most recent clip to a named clipboard which I can access
Use a lot of different macros using hotkey of the OCR app so rather than adding "save system clipboard to named clipboard" everywhere, I am hoping there must be a way to directly capture all clipboard from one app to named clipboard

Thanks in anticipation

If you are just trying to save plain text, then there is no benefit in using Named Clipboards. It would be much better use KM global Variables for this purpose. You could append the text your get in each macro/app to the same KM Variable, like this:

image
image

After one macro (the first) it would look like this:

image

If the OCR'd text is always just one line, then you could simplify like this:
image

If the results of the OCR process is always on the clipboard, then you could use:
image

When you are finished with one set of OCRs, you could then process the collection using:

Does this address your needs?

Questions?

I understand what you're doing here, but the problem is I have a few macros that use the OCR (I just add action type keystroke ctrl+1) , so adding this to all of these would be amazingly cumbersome.
Secondly there's one more challenge:
There are 2 steps of variable wait times: 1st when I have to take a picture (highly variable) , 2nd wait is the time OCR app takes to recognize the text (which is usually very short)

The whole process:
I press ctrl+1 hotkey to take an interactive screenshot like thing to send image to OCR app for recognition.
Once I take the specific image (this takes variable time depending upon how much and what I want to OCR), the OCR app send the recognized text to system clipboard (but this doesn't persist)

Now suppose I did OCR for something, but then did a lot of other copy-paste in between, I still want to be able to paste last OCR result.

TL,DR: Now I want to be able to create a macro that basically uses clipboard sent from the OCR app as a trigger to save that clipboard data to named clipboard so that I always have the last OCR result saved without having to modify so many of my macros

(But the problem is that the app is a menu bar app that doesn't act as a running app but has a global hotkey to trigger text recognition, so I cannot just Create a macro group for the app)

OK, well if you consider adding ONE KM Action to be "amazingly cumbersome", I'm not sure how I can help. If you are mixing the clipboard with OCR results and other stuff, then you are creating your own problem.

Can the OCR tool output its results elsewhere, like to a file in a set folder?

I'll stop there for now.

Haha. Anyway I just changed all the type keystroke ctrl+1 to execute Macro "OCR hotkey" so now I'll add that instead of ctrl+1 to all future macros requiring OCR.

But how do I tackle the variable wait times?

I was thinking I capture system clipboard then run hotkey and wait until clipboard changes because once I have triggered the OCR global shortcut ctrl+1 the only thing that'll change the clipboard now will be OCR app.

I tried that but it kind of works, the problem is sometimes I press escape because I might need to do something else before running this macro. Now the problem is the macro still keeps waiting for clipboard change and runs unexpectedly sometime else.
(This is a problem I am having with some of my screenshot macros also where I stop midway by pressing escape but then when the Pause condition is fulfilled sometime later in a different context it continues the macro at a wrong time)
TL,DR:
Question 1: How do I wait for OCR to finish recognition (variable time gap)?
Question 2: What's the best way to cancel any one running/ (in pause condition) macro midway?

that's nice, but it is meaningless to me.
If you want my help, then you'll need to answer my questions:

Oops Sorry. :slight_smile:
No it doesn't. Only to clipboard only once

1 Like

OK, so we have to deal with the OCR results on the clipboard.

To be clear, it is NOT possible for the OCR app to put on a KM Named Clipboard. Only KM can do that, and AFTER it has been put on the main System Clipboard.

But, again, there is no need for Named Clipboards here.
After the OCR app has put the results on the Clipboard, the BEST option is to put those resutls into a KM Variable, as I showed you in my first post:

If you still find that "amazingly cumbersome", and is unacceptable, then I really can't help you.
I have no idea what you mean by that. Adding one Action is NEITHER "amazing" NOR "cumbersome".

You may want to keep in mind that sometimes we must construct relatively complex programs (KM Macros in this case) in order to automate/simplify our workflows. If the workflow is something that you will often do, then spending the time to automate with multiple steps is usually worthwhile. But that's all up to you.

Thanks a lot.
I completely agree with you.
And I am adding this code. But the problem is how do I take care of the variable wait times ( time between triggered hotkey to image getting recognized and sending to clipboard)
Sometimes if it takes too long, the macro just adds the current system clipboard (not from OCR app) to the variable.

You can use the CLIPBOARDSEED function to determine when the clipboard has changed.

Here are the actions I use to wait on SnagIT to complete its copy to clipboard:

image

1 Like

@forums2012 , I hope you don't mind that I have revised your topic title to better reflect the question you have asked.

FROM:
Is there a way to send all clipboard from one application (basically an Text recognition app) to named clipboard automatically?

TO:
How Can an App Send All Data to a KM Named Clipboard?

This will greatly help you attract more experienced users to help solve your problem, and will help future readers find your question, and the solution.

2 Likes

Awesome! Thanks a lot.

I ended up creating a set Variable "CurrentClipBeforeOCR" to system clipboard before the hotkey, then pause until "CurrentClipOCR" is not system clipboard.

Is your method of ClipboardSeed() a better way?

Yes. It requires less system resources than actually checking the clipboard using your method.

@forums2012, this is about the 3rd time that I have wasted time providing you with a solution, then you say you already have it solved. If you have a solution when you make your OP, or thereafter, you should update the thread with your solution. I don't have time to waste like this. You seem to be doing well enough on your own, so I'll back off for now.

Good luck!

1 Like

Hey really sorry for the trouble.
Kind of new and figuring out things and wanted to hear from the experts.
You seem to be a pro on the forums, so definitely wanted to hear your thoughts.

Thanks a lot for your time! Really appreciate it!
Again sorry for wasting your time.
But your solutions are definitely helping me a lot! Thanks a lot!

1 Like