Data entry in "Prompt for User Input" copied

Forgive me but I am brand new to KM.
I have 2 apps that I constantly need to type the same bar code in. I was thinking I could use "Prompt for User Input". The window comes up and I enter the bar code in "Variables and Default Values". However I cannot seem to have KM copy that data so it can be pasted into the apps.
Any suggestions? A better macro to use? Thanks.

You can use the Set Clipboard to Variable action, which should do what you want:

-rob.

2 Likes

This worked great! This will save me 30 seconds 100 times a day. It was such a nuance. Thanks!

2 Likes

@griffman has solved your question of how to transfer the input value of the Variable to the Clipboard.

One thing to bear in mind is that the Clipboard will change as soon as you copy and paste anything else which would mean going through the process again, to restore your barcode into the Clipboard.

When I have to do this sort of thing I find it is useful to use a Global Variable that can hold the value in case I need to access it again later in the day after doing other actions with the Clipboard.

A neat trick with Keyboard Maestro is to make the default value of the input field, the value of the Variable you are prompting for.

Instead of something like this (which will always show "1234" as the default value):

You can do something like this:

The first time this prompt is run, the input field will be blank. But after inputing some text, the next time you run the Macro that text will be what you last set the input as.

What this means is that if at a later point in the day, you want to get that same barcode back into the Clipboard you simply run your Macro and hit return to get your last used Value back into the Clipboard ready for pasting. This is a trick I use constantly now, but it took me a while to realise how to do it.

EXAMPLE User Input to Clipboard with Global Variable

EXAMPLE User Input to Clipboard with Global Variable.kmmacros (2.9 KB)

With Variables it is worth having a read about the different kinds of Keyboard Maestro Variables. There are three kinds - Local, Instance and Global. They all have their different uses. In my example I used a Global Variable as I wanted its value to persist between Macro runs. But if the value is not needed to persist you would use a Local Variable (any Variable named with "local" at its start). This is an issue that causes much confusion when first starting with Keyboard Maestro which is why I would recommend reading the help article on it:

https://wiki.keyboardmaestro.com/manual/Variables

2 Likes