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 [2017/09/06 06:28] – [See Also] peternlewis | action:Prompt_for_User_Input [2023/09/13 04:04] (current) – [Slider Field] peternlewis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{: | + | ====== Prompt For User Input Action |
| - | ====== Prompt For User Input ====== | + | |
| - | _Prompt For User Input_ allows you to design a form that will ask for user input, storing the results in [[: | + | _Prompt For User Input_ allows you to design a form that will ask for user input, storing the results in [[manual: |
| - | ===== Example ===== | + | You can prompt for variables with text, checkbox, popup menu, or password fields. |
| - | **This Setup of the Prompt | + | {{ promptaction.png? |
| - | {{:action:promptaction.png|}} | + | This action |
| - | **Produces this Display*** | + | {{ promptwindow.png? |
| - | + | ||
| - | {{:action:promptwindow.png|}} | + | |
| ===== Form Fields ===== | ===== Form Fields ===== | ||
| Line 21: | Line 18: | ||
| |Form Title|Display Only|Identify the Main Purpose of the Form| | |Form Title|Display Only|Identify the Main Purpose of the Form| | ||
| |Prompt|Display only|Optionally provide instructions and/or display Variables| | |Prompt|Display only|Optionally provide instructions and/or display Variables| | ||
| - | |Keyboard Maestro Variables|Display/ | + | |Keyboard Maestro Variables|Display/ |
| - | |Buttons|Standard Mac|Allow | + | |Buttons|Standard Mac|Allow |
| ==== Form Title ==== | ==== Form Title ==== | ||
| Line 39: | Line 36: | ||
| The Form may contain zero or more _Variable_ lines, with each line providing two form fields: | The Form may contain zero or more _Variable_ lines, with each line providing two form fields: | ||
| - | - [[: | + | - [[manual: |
| - | - Value of the _Variable_ | + | - A default value for the _Variable_, which also implies the type of entry. |
| - | - May optionally have a default value | + | |
| - | - Can be edited by the User | + | |
| - | Each _Variable_ | + | Using the menu selection to the right of the default |
| - | * Text (single-line) | + | * Automatic |
| - | * Popup Menu | + | * Text |
| - | * Checkbox | + | * Password |
| - | * Password Field | + | * Checkbox |
| - | * If the Variable name starts or ends with “Password” or “PW”, | + | * Menu |
| + | * Slider | ||
| + | * Color | ||
| + | * Date | ||
| + | * Date and Time | ||
| + | * Time | ||
| + | * Time with Seconds | ||
| + | |||
| + | ==== Automatic ==== | ||
| + | |||
| + | Automatic type will guess the type based on the value of the default field - if it contains “|” bar separated fields, then it will be a menu, or a checkbox if all the values are 0 or 1, and if the variable is a Password variable (starts or ends with “Password” or “PW”), then a password field will be used. | ||
| ==== Text Field ==== | ==== Text Field ==== | ||
| - | ==== Popup Field ==== | + | The field will be displayed as a single line text input field. |
| + | The default field is a token text field. | ||
| - | Simply enter a default value with the Popup Choices separated by a bar (|), like this: “`Good|Better|Best`” | + | ==== Password Field ==== |
| - | * Then a popup menu will be used. | + | The field will be displayed as a single line password input field, displayed with bullets instead of characters. |
| - | * The first value in the list of choices | + | |
| - | * You can assign a different default value for the Popup, by entering that value as the first choice listed (For example, if you would like " | + | |
| - | === Using a Variable for Popup Choices === | + | The default field is a token text field. |
| + | ==== Checkbox ==== | ||
| - | To use a Variable for the popup choices, see: | + | 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 |
| - | * [Dynamic Default List for Prompt for User Input (Example)](https:// | + | |
| - | === Using a Dash (" | + | The default field is a token text field. |
| - | If a popup menu item is a dash (-), then a separator is displayed. For example, “%%Good|Better|Best|-|Terrible%%” | + | ==== Menu Field ==== |
| - | === How to Store a Different Value than Displayed === | + | The field will be displayed as a popup menu. |
| - | Sometimes you may want to display a " | + | The default |
| - | If a popup menu item starts with a prefix followed | + | The first value in the list of choices will be selected in the menu by default. For example, if you would like " |
| - | For example “%%B__Good|F__Fail|C__OK|B__Good|A__Excellent%%” would be shown as: | + | If the menu item is a dash “-”, a menu separator will be used in its place. |
| - | ``` | + | If a menu items is separated in to two parts with two underscores (‗), then the first part is used as the result, while the second part is displayed in the menu. For example, “B‗‗Good|F‗‗Fail|C‗‗OK|B‗‗Good|A‗‗Excellent”. |
| - | Fail | + | |
| - | OK | + | |
| - | Good | + | |
| - | Excellent | + | |
| - | ``` | + | |
| - | but would set the variable to A, B, C,or F as appropriate. | + | 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 |
| - | === How to Use a Variable for the Popup Choices | + | ==== Slider 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 value defines |
| + | 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. | ||
| - | === How to Hide a Variable Prefix in the Prompt === | + | For example, “0, |
| - | It is a good idea to have a common prefix | + | The result stored |
| - | **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. | + | This default value field is a calculation field. |
| - | For example, if you enter " | + | Up to Keyboard Maestro version 10.2, the result |
| - | * It will display a label of " | + | |
| - | * But the actual variable name that is set will be just as you entered it: " | + | |
| - | ==== Checkbox | + | ==== Color Field ==== |
| - | If the popup menu would contain only "0" | + | The field will be displayed as a color well. |
| + | |||
| + | The default | ||
| + | |||
| + | This default value field is a calculation field. | ||
| + | |||
| + | ==== Date and Time Fields ==== | ||
| + | |||
| + | The field will be displayed as a date, date & time, time, or time with seconds field. | ||
| + | |||
| + | The default value is [[/ | ||
| + | |||
| + | This default value field is a calculation field. | ||
| + | |||
| + | ==== 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 | ||
| ==== Buttons ==== | ==== Buttons ==== | ||
| Line 115: | 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 === | ||
| The [[token: | The [[token: | ||
| - | |||
| - | Note that the system will not allow Keyboard Maestro Engine to see keys typed in its own windows so the [[trigger: | ||
| === 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 " | ||
| * Other buttons have no default key. | * Other buttons have no default key. | ||
| - | * Whatever button has the key < | + | * Whatever button has the _RETURN_ response |
| - | * 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 154: | 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 ===== |
| - | Note that the system | + | Note that the system |
| ===== See Also ===== | ===== See Also ===== | ||
| Line 167: | Line 189: | ||
| * [[action: | * [[action: | ||
| + | * [[action: | ||
| + | * [[action: | ||
| + | * [[action: | ||
| * [[action: | * [[action: | ||
| * [[action: | * [[action: | ||
action/Prompt_for_User_Input.1504679293.txt.gz · Last modified: by peternlewis
