A macro which remembers previous input

I have a macro, which is one of several macros, I use for image analysis. The program (Fiji) I use the macro with requires a threshold value. I currently use "prompt for user input" for this. This value varies but does tend to remain the same through different samples. I would like the default value of "prompt for user input" to reflect this so I just have to tap return rather than reenter the same value. I guess this might involve a Local variable but I'm not sure how to use this. Help would be appreciated. Thank you.

Use a global and it will be remembered. A local variable will not.

Maybe this will set you on track

Selected_From_List.kmmacros (1.5 KB)

@simon has given you the method with the Prompt from List.

If you want to do this in a standard Prompt for User Input Action you use a Global Variable as @mrpasini says and you quote that Global Variable like this:

EXAMPLE User Input with Saved Value.kmmacros (2.4 KB)

Initially the prompt box will show no value (as the Variable is empty) but after first use it will always show the last value entered and hitting return will confirm the choice.

Thank you for the suggestions. It turned out that because I didn't know what I was doing that I had in fact accidentally created a global variable, I had just not configured it correctly. Now everything works and my macro is smarter. :blush:

1 Like