Use Input from regular expression to copy to clipboard

So I have a trigger that is triggered from a barcode scanner using this
\b503\d.*\r

so Reg expression match, is the trigger, can I copy that input to the clipboard?

Yep. Just set the clipboard to "%TriggerValue%".

That works, but looks like I need to interrupt that input from effecting other input,
What I am trying to do is I have a highlighted item in Finder (self selected)
I then use a scanner and input "5031828371879" for example. (the scanner when used contains those number plus a return stroke.

This then triggers the macro, > copies to clipboard >Key Stroke return > Paste clipboard. Item is renamed. (should)

However in finder when you key a number or letter it will try to jump to the item labelled 50......

I need to attempt to prevent that input to allow my macro to take over.

Before the Type a Keystroke, you need to tell the Finder to rename its currently selected item:

image

BTW, instead of setting the Clipboard and the pasting it, I would just use one Action:

image

Excellent! That works a treat I Also want to copy the trigger Value to the clipboard but need to remove the return key thats part of the trigger value, can you help with that too?
Thanks
Matt

I've just noticed that it still recognises the input and jumps up

If I have
MJC_5733.jpg
MJC_5734.jpg
If the last is selected, when I scan it jumps to the first item and renames that one.

Here is an example of how to remove any/all New-Line characters (CR, LF) from the end of a Variable. You will need to integrate this with your Macro.

image

Uses this RegEx:
(.+)\R*

As an alternative to the RegEx, you could use the Filter Action (which is disabled) in the Macro. This will remove the return key (actually ALL whitespace) from beginning and end of a KM Variable.

I've not given you any macros or actions that select the file in the Finder, so this must be cause by something else.

This works fine for me:

Select a file in the Finder, and trigger this macro:

image

Using the filter seamed to work well!

I'm developing that a little more but still having some basic issues, comparing the clipboard and the select finder item.

I'll start a new thread once I figure what I want to achieve.

Thanks for you help.