# Prompt

The Prompt statement is intended to be used to interact with a running action. You specify a prompt message to be displayed by default in the Action Pending Window. The prompt is only issued once per set of files when run stepwise.

You can configure up to four buttons. See Configuring Buttons on Prompt Statements for more information. Which button was pressed can be determined from the Prompt Chosen Button named variable. There is no requirement for buttons to be contiguous. At runtime when a button configured to be a Menu is hit and a menu item is selected, the panel is closed and named variable Prompt Menu Item Reference will reference which menu item was selected. The Prompt Menu Formatting topic describes how to format the menus.

You can provide simple markup for the text specifying colours, bold and italic. The markup sequences are described in Common Prompt Markup Functionality. Note that when using markup sequences the colour specified in the colour control is ignored. Further, markup sequences are only parsed when the prompt text is displayed in the Action Pending window.

The supplied prompt string may contain any of the escape sequences described in Escape Sequences. The prompt is a multi line scrolling area.

You can elect to issue a beep with the prompt.

You can optionally display the step information. The step information displays the statement, the name of the file which was being processed and the name of the action and line number which contains the statement.

When enabled, the Ignore if batched option will suppress the prompt if the action is run via the Batch Processor.

The statement supports additional configurability which is documented in Advanced Prompt Statement Functionality. These settings can be configured by clicking on small button with the gear icon.

The following modes are available:

Standard
  As the name implies this is the standard mode of operation. When not batch processing, the Action Pending Window is displayed. When batch processing, the prompt is placed into the log file with the issuing action's information.
UI
  When not batch processing, the mode is the same as Standard. When batch processing, the prompt is issued to the UI via the Action Pending Window.
Plain Text
  When not batch processing, the mode is the same as Standard. When batch processing, the prompt is is placed into the log file without the issuing action's information. The text is written as is without any leading or trailing newline characters added.
Alert
  The prompt is issued as a system alert as opposed to via the Action Pending Window. Either the standard OS alert style or Yate's alternate alert style will be used. The Hide info option is effectively enabled. Colour settings are ignored and markup is not parsed. The default title is Yate. Special considerations for this prompt type:
  - while there is no requirement for configured buttons to be contiguous, this mode will only display buttons up to the hole. eg. If buttons 1, 2 and 4 are defined, only buttons 1 and 2 will be displayed.
  - A Menu button is treated as a Continue button. ie. no menu is displayed.
Critical Alert
  Same as Alert with the exception that the application icon is displayed as indicating a warning.
Menu
  This mode display a popup menu at the cursor position. The menu formatting is described in the Prompt Menu Formatting topic.
Popup Window
  The prompt (markup supported)is displayed in a popup window centered on the display. When the window is dismissed by clicking off the window or by the escape key, the action will resume.
Status
  When performing lengthy operations it may be desirable to display status information. The status information is displayed on the main window's status bar. With the exception of the Ignore if Batched option, all other settings are ignored.
DB Status
  When performing lengthy operations it may be desirable to display status information. The status information is by displayed on a database window's status bar. If the named variable Prompt DB Status Path contains the full path of an open database window the status message will be displayed on that window. Status messages displayed in database windows persist until an action or the batch processor terminates or a grab is released. The path associated with an open query database can be referenced as prefix-Path. With the exception of the Ignore if Batched option, all other settings are ignored.
System Log
  This mode will cause the message to be logged to the system log. With the exception of the Ignore if Batched option, all other settings are ignored. These messages can be viewed with the Console application by clicking on your Mac in the sidebar under Devices. Note that the availability of the message in the Console application may depend on whether it was running at the time the message was issued. On Sierra and later, messages intentionally issued by Yate can be viewed by the following command when executed in the Terminal:
  log show --predicate 'process == "Yate" and eventMessage beginswith "(Yate-App)"'
User Log
  This mode will cause the message to be logged with a time stamp to a text file. If named variable Prompt User Log Path is empty the message will be logged to ~/Library/Logs/Yate-User.log. If named variable Prompt User Log Path is not empty, it must contain a valid path to a file. The file will be created if it does not exist. With the exception of the Ignore if Batched option, all other settings are ignored. When the default location is used the messages can be viewed with the Console application in the Log Reports sidebar item. Note that the logged messages persist until a Prompt statement with a Flush User Log mode is executed.
Flush User Log
  This mode will delete the file as specified or implied in the User Log mode. The file will be recreated whenever a Prompt statement with a User Log mode is issued.
Reset
  Many action statements which fall in the Prompt category use named variables for additional configuration purposes. If you select the Reset mode, all Prompt configuration named variables except Prompt Title will be reset. All other settings in the statement are ignored and no prompt will be issued. The following is a complete list of the named variables which will be cleared:
  - Prompt Cancel Warning
  - Prompt Checkbox Mixed
  - Prompt Checkbox Text
  - Prompt Checkbox Value
  - Prompt Chosen Button
  - Prompt DB Status Path
  - Prompt Default Button
  - Prompt for Fields Constraints
  - Prompt for Fields Exclusions
  - Prompt for Fields Initially Selected
  - Prompt for Fields Results
  - Prompt for Path Button
  - Prompt for Path Filename
  - Prompt for Path Folder
  - Prompt for Text Append Delimiter
  - Prompt for Text Formatting
  - Prompt Menu Item Reference
  - Prompt for Text R/O
  - Prompt for Text Selection
  - Prompt for Text Overwrite