Remove Dashes

Hi there:
I want to

  1. OCR a number from the screen to clipboard or variable(got that part working)....phone number format 111-111-1111
    THEN
  2. convert that to 1111111111(remove dashes), then paste by typing

Can't get the second part to work(don't see an option to strip characters from clipboard), any suggestions?

Thank you for your assistance

1 Like

image

That will replace "dashes with nothing" in the clipboard.

If you want to show your macro, we might be able to give other good advice to help you.

1 Like


Thank you so much for the prompt response!

Hey @DDuser,

See the wiki – Search and Replace Clipboard action

Keep in mind insert action by name makes finding things easier.

-Chris

You are welcome. If you find that code to be reliable, then leave it that way. If you find that it returns the wrong number sometimes, there are ways to fix that. One way might be to increase the zoom level of the app you are using. I can think of three other ways, so let us know if your OCR is getting the wrong answer too often. If it is, you should create another post because that's a different problem.

Thank you so much, if you have any suggestions on other ways to capture the text from the screen, that would be appreciated. My approach seems to work 80% of the time.
Also, even when I use insert text by typing, there is a return at the end, is there a way to avoid that? Just want the phone number only to be typed. The target program is pretty picky.

Well, you are using KM's OCR action, which has finicky accuracy. There are tricks to make it more accurate. But the best way to make it nearly perfect accuracy is to use the new OCR action in Monterey instead of the one in KM. Do you have macOS Monterey? If you do, you can learn how to use it by searching this forum for the words: Monterey OCR

There are lots of ways to solve that. Since I don't see your macro, I can't really tell you the simplest way to fix your problem. But based on what you've told me, I think you need this:

image

That is brilliant, thank you, that got it to work. Have not tried much of the built in OCR in Monterey but will give it a look and see. I have actually used TextSniper for some time, works really well, I think it works better based on reviews that the built in OCR in Monterey

Thank you again for the help and the fast responses
My macro in the end:

TextSniper looks amazing. In fact it looks too good to be true, because a single developer from Latvia, who claims to be self-taught, has produced this amazing software? In my opinion it sounds like perhaps the Russian government using the author as a cover to distribute their software. I can't prove that, but I don't put any software on my Mac until I have a high level of confidence in it.

Looking at your other posts on OCR in Monterey, very creative, will take a look.
Textsniper is available through the Mac app store as well.

That's a good point, and I can't say your decision to use it is bad for you, but I still wouldn't trust any hostile government with billions of dollars for a hacking budget to install their software on my PC, even if it's via the Apple App store. As far as I can tell KM is written in Australia and Australia is a close ally of Canada, so I'm not worried about this as far as KM goes. :slight_smile: