action:Prompt_for_User_Input
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| action:Prompt_for_User_Input [2021/10/14 05:15] – peternlewis | action:Prompt_for_User_Input [2023/09/13 04:04] (current) – [Slider Field] peternlewis | ||
|---|---|---|---|
| Line 59: | Line 59: | ||
| The field will be displayed as a single line text input field. | The field will be displayed as a single line text input field. | ||
| + | |||
| + | The default field is a token text field. | ||
| ==== Password Field ==== | ==== Password Field ==== | ||
| The field will be displayed as a single line password input field, displayed with bullets instead of characters. | The field will be displayed as a single line password input field, displayed with bullets instead of characters. | ||
| + | |||
| + | The default field is a token text field. | ||
| ==== Checkbox ==== | ==== Checkbox ==== | ||
| The field will be displayed as a checkbox. If the default value is “0”, or starts with “0|”, then the checkbox will default to off. If the default value is “1”, or starts with “1|”, the checkbox will default to on. | The field will be displayed as a checkbox. If the default value is “0”, or starts with “0|”, then the checkbox will default to off. If the default value is “1”, or starts with “1|”, the checkbox will default to on. | ||
| + | |||
| + | The default field is a token text field. | ||
| ==== Menu Field ==== | ==== Menu Field ==== | ||
| Line 76: | Line 82: | ||
| The first value in the list of choices will be selected in the menu by default. For example, if you would like " | The first value in the list of choices will be selected in the menu by default. For example, if you would like " | ||
| - | === Using a Variable for Popup Choices === | + | If the menu item is a dash “-”, a menu separator will be used in its place. For example, “Good|Better|Best|-|Terrible”. |
| - | To use a Variable for the popup choices, see: | + | If a menu items is separated in to two parts with two underscores |
| - | * [Dynamic Default List for Prompt for User Input (Example)](https:// | + | |
| - | === Using a Dash ("`-`") to Separate Choices === | + | The default field is a token text field, so you can include variable options in your list, for example: “%Variable%First Choice%|%Variable%Second Choice%”. If you want to provide a list in a variable, then you do so by starting the field with a bar (“|”), followed by your list (or your default value and then your list) in a variable |
| - | If a popup menu item is a dash (-), then a separator is displayed. For example, “%%Good|Better|Best|-|Terrible%%” | + | ==== Slider Field ==== |
| - | === How to Store a Different Value than Displayed === | + | The field will be displayed as a slider. |
| - | Sometimes you may want to display a " | + | The default |
| + | 0. initial value of 50, range 0-100. | ||
| + | 1. initial value as specified, range 0-100. | ||
| + | 2. range as specified, initial value half way between. | ||
| + | 3. minimum, initial, maximum value as specified. | ||
| + | 4. minimum, initial, maximum value as specified, and if the last value is greater than zero, the gap between allowed values, and if it is less than zero, the number of allowed values. | ||
| - | If a popup menu item starts with a prefix followed by two underscores, then the prefix will be used as the variable | + | For example, “0, |
| - | For example “%%B__Good|F__Fail|C__OK|B__Good|A__Excellent%%” would be shown as: | + | The result stored in the variable will be the value of the slider. |
| - | ``` | + | This default |
| - | Fail | + | |
| - | OK | + | |
| - | Good (selected by default) | + | |
| - | Excellent | + | |
| - | ``` | + | |
| - | but would set the variable | + | Up to Keyboard Maestro version 10.2, the result of the slider will always be an integer, and any initial value above 100 will be clipped to 100 ([[https:// |
| - | === How to Use a Variable for the Popup Choices | + | ==== Color Field ==== |
| - | * Sometimes you might like to use a Keyboard Maestro Variable to store the list of Popup Choices, and then use this Variable in the Prompt for User Input Action. | + | The field will be displayed |
| - | * If the Popup default value starts with a bar (|), then the Variable (which contains choices separated by `|`) will be expanded and evaluated before the Prompt is displayed, thus showing the choices from the Variable. | + | |
| - | Otherwise, | + | The default |
| - | === How to Hide a Variable Prefix in the Prompt === | + | This default value field is a calculation field. |
| - | It is a good idea to have a common prefix in all of the variables used by the same macro. | + | ==== Date and Time Fields ==== |
| - | **So, you can hide the prefix if the variable name starts | + | The field will be displayed as a date, date & time, time, or time with seconds field. |
| - | For example, if you enter " | + | The default value is [[/ |
| - | * It will display a label of " | + | |
| - | * But the actual variable name that is set will be just as you entered it: " | + | |
| - | ==== Checkbox Field ==== | + | This default value field is a calculation field. |
| - | If the popup menu would contain only " | + | ==== Labels ==== |
| + | |||
| + | It can be a good idea to have a common prefix in all of the variables used by the same macro. | ||
| + | |||
| + | So, you can hide the prefix if the variable name starts with a prefix followed by two underscores. Then the label will show only the latter part of the variable name. | ||
| + | |||
| + | Similarly, you can use Instance or Local variables, and the “Instance” | ||
| + | |||
| + | For example, variables named “MyMacro‗‗Text Message”, “Instance Text Message” or “Local Text Message” will all display the label “Text Message” in the form. The actual variable used will be the full variable name. | ||
| ==== Buttons ==== | ==== Buttons ==== | ||
| Line 128: | Line 138: | ||
| - {{: | - {{: | ||
| * Responds to shortcut < | * Responds to shortcut < | ||
| - | * Closes the Prompt | + | * Closes the Prompt. |
| - | * Flows proceeds to next Action | + | * Flows proceeds to next Action. |
| - {{: | - {{: | ||
| * Responds to shortcuts of either < | * Responds to shortcuts of either < | ||
| - | * Closes the Prompt | + | * Closes the Prompt |
| * **Cancels the Macro** | * **Cancels the Macro** | ||
| - | === Optional Buttons Can be Assigned Shortcut Keys === | + | You can add more buttons to allow for other options. For example, “Save” and “Save and Send”. |
| - | You can optionally assign a shortcut key by applying a suffix to the Button Name in the form of / | + | You can optionally assign a shortcut key by applying a suffix to the Button Name in the form of / |
| ^Suffix^Button Responds to Shortcut Key of:^ | ^Suffix^Button Responds to Shortcut Key of:^ | ||
| |`/ | |`/ | ||
| |`/ | |`/ | ||
| - | |`/ | + | |`/ |
| + | |`/-`|no shortcut| | ||
| === Result Button === | === Result Button === | ||
| Line 150: | Line 161: | ||
| === How Buttons are Processed === | === How Buttons are Processed === | ||
| - | * The first button (from the top) has a default key of < | + | * The first button (from the top) has a default key of < |
| * The second button has a default key of either < | * The second button has a default key of either < | ||
| * Any button can _Cancel_ the macro if the " | * Any button can _Cancel_ the macro if the " | ||
| Line 157: | Line 168: | ||
| * If you have the system preference “Use keyboard navigation to move focus between controls” enabled, the button shown with a colored outline (usually blue) can be chosen/ | * If you have the system preference “Use keyboard navigation to move focus between controls” enabled, the button shown with a colored outline (usually blue) can be chosen/ | ||
| - | **Guidelines for Good Button | + | === Guidelines for Good Button |
| - | * The default button should be the "OK" | + | * The default button should be the “OK” button, the one that performs the *normal behaviour*. |
| * The default button should be rightmost. | * The default button should be rightmost. | ||
| * The left most button should be " | * The left most button should be " | ||
| Line 165: | Line 176: | ||
| * If the normal behaviour is significantly dangerous, then it may be appropriate for it to not be the default button, or for there to be no default button. | * If the normal behaviour is significantly dangerous, then it may be appropriate for it to not be the default button, or for there to be no default button. | ||
| - | " | + | “Normal |
| A consequence of all of this is that if you have a second button in the Prompt For User Input action, and it does not cancel the macro, then you should definitely give it some other key, or disable it with “/-”. | A consequence of all of this is that if you have a second button in the Prompt For User Input action, and it does not cancel the macro, then you should definitely give it some other key, or disable it with “/-”. | ||
| - | |||
| - | An update is planned so that if the first button has the Cancel Macro flag, then it is not the default (by default), and if the second button does not have the Cancel Macro flag, then it does not get the Escape/ | ||
| ===== Notes ===== | ===== Notes ===== | ||
| Note that the system will not allow Keyboard Maestro Engine to see keys typed in its own windows so the [[trigger: | Note that the system will not allow Keyboard Maestro Engine to see keys typed in its own windows so the [[trigger: | ||
| - | |||
| - | Note that the system really really wants a " | ||
| ===== See Also ===== | ===== See Also ===== | ||
action/Prompt_for_User_Input.1634188528.txt.gz · Last modified: by peternlewis
