Double Underscores to Display "Friendly" Value

Hello,

For Prompt with List Action, you can use a double underscore to display a "friendly" value than the actual value. However, my actual values includes the double underscores, examples: status__c, status__v, state__v, etc.

Is it possible to replace the reserved double underscores with something else?

https://wiki.keyboardmaestro.com/action/Prompt_With_List

Thanks,
Chris

No.

You could use an intermediary variable in the form and transfer that to your variables with the double underscore names if they are non-negotiable.

Hi, @ChrisQ. Here's the approach I use.

I created two subroutines.


The first subroutine is used to process the list items for the Prompt With List action.

Download: 𝗌.𝘂⇾ProtectUnderscores.kmmacros (5.0 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.3 (22E7752300g) PRE-RELEASE SEED SOFTWARE
  • Keyboard Maestro v10.2


The second subroutine is used to process the selected item.

Download: 𝗌.𝘂⇾UnprotectUnderscores.kmmacros (5.0 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.3 (22E7752300g) PRE-RELEASE SEED SOFTWARE
  • Keyboard Maestro v10.2


Here's an example using the two above subroutines.

Download: Protecting Underscores for a Prompt With List.kmmacros (7.8 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.3 (22E7752300g) PRE-RELEASE SEED SOFTWARE
  • Keyboard Maestro v10.2


If you have any questions after reading the enclosed comments in the subroutines, please let me know.

3 Likes

Hi @_jims, I imported your macro and sub-routines, gave it a test run and it worked perfectly with the Projects folders.

Subroutines are new to me. I tried to avoid it before, but you are forcing me to learn it :sweat_smile: I need a few days to go through this and try to digest it.

Really appreciate you taking the time out to create the macro/sub-routines. :slight_smile:

Chris

2 Likes

Hi @_jims, I tried to tweak your macro/subroutines for my specific test case but I was unsuccessful to. I gave up after awhile :frowning:

Wondering if you could tweak your macro so Prompt with List from a file does:

  • Displays the whole line, not just the "friendly" name
  • When user selects the line from prompt, the whole line is selected

This gif demonstrates the issue I'm having with double underscores used for "friendly" name. It is not my unsuccessful tweaked macro that I tried.
double_underscores

Thanks again,
Chris

Hi, @ChrisQ. I think I understand your objective. Download and try this. Note that this example also requires the two subroutines I shared above.

Download: Protecting Underscores for a Prompt With List [Example 2].kmmacros (8.5 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.3 (22E5236f) PRE-RELEASE SEED SOFTWARE
  • Keyboard Maestro v10.2

1 Like

Hi @_jims,

Thank you so much for such a quick response with the modified macro that works perfectly. I really appreciate your efforts.

Btw, as a work around, I was listing my values as "_._v" and then manually removing the "." afterwards. But with your macro, everything works. :slight_smile:

Chris

1 Like