Why do "?" appear in my file names in the finder but the same text sent to drafts does not show them?

Hello,

I am renaming files quite successfully save for one thing. Question marks appear in my file names where there was a line break. I am using a screen capture macro as part of my file renaming solution. I capture a place inside a file with screen capture and it changes the name to the contents in that screen capture, but it adds "?". I disabled the end of the macro and sent the new file name contained on the system clipboard to drafts. There are no "?" when the clipboard goes there, only in the file names. Hoping someone has an answer for this.

Thanks

You probably need to do a replace of line break \R with a SPACE.
But that's just a wild guess. You need to upload your macro for better help.

Please read:
Tip: How Do I Get The Best Answer in the Shortest Time?

I would like to add that i just realized that any pdf file I run the macro on is being auto converted from pdf to textedit. If I add a "?" to a file and drag it into a folder I have hazel watching that removes "?" from file names, it immediately removes it if it is a pdf. If i drag a file in that has "?" in the name but has been changed to textedit, hazel does not see the question marks and does nothing with them. The "?" are both there and not there.

My Macro

OCR -- User-Selected Area.kmmacros (15 KB)

I suspect that either the OCR or the RegEx is NOT working as you expect.
So, to find out you need to debug your macro.

Insert this Action:

Open the KM Window > Value Inspector, and add the two Variables you are using:

image

Trigger your macro and it will break just after the OCR.
Step through the macro observing the values of the Variables.
Hopefully this will show you what is wrong.

What it showed me was:

My macro works fine, it just doesn't do the right thing. In other words, the debugger did not reveal anything new. The name both does have and does not have "?" in it at the same time. Displayed on the screen there are no "?". In the finder, there are.

I have figured out that if you set a variable based on a file name and then use it to change a filename which has been set to another variable, that second variable does not get "reset" with the new name. You need to reset it to the file a second time where it goes and retrieves the new file name. Basically at this point, the macro works, save for one thing. The "?" in the name which appear in finder but are invisible to KM and Hazel. I can't get them out of the name except by simply backspacing them out manually, which makes this somewhat complex macro worthless, as that takes more time than just typing the new name in the first place. If anyone can explain the mystery "?" that would be great.

Below Is latest copy of macro

Newest copy as of 8 am Oct 3, 2020

Rename ABC Invoice.kmmacros (15 KB)

I did a search and replace variable "FIle_Name"
search was : \r?\n
replace was: "a blank space"

It worked. Thanks.