d.ask(1)

NAME
d.ask - Prompts the user to select a GRASS data base file from among files displayed in a menu on the graphics monitor.

SYNOPSIS
d.ask
d.ask help
d.ask element=name,description [prompt="message"]

  Parameters:

element=name,description
    Database element , one word description

prompt=
    Short user prompt message

DESCRIPTION
d.ask is designed for shell scripts that need to prompt the user for the name of a data base file in the user's current GRASS mapset search path. After d.ask is invoked with needed parameters, the mouse becomes active and a menu containing files of the specified element type is displayed on the user's graphics monitor. The user is prompted by the prompt "message" to select one of the listed file names with the mouse. Specifically, the query that appears to the user takes the form:

Double click on the prompt "message" Double click here to cancel

(A list of files of the specified element type from each of the mapsets listed in the user's mapset search path is also displayed.)

After the user responds, the mouse is deactivated and the displayed menu is erased from the screen (leaving any underlying materials on display intact). Three lines are written to standard output (the user's terminal screen):

name=file_name mapset=mapset_name fullname=file_name@mapset_name

  Parameters:

element=name,description
    Name of a GRASS data base element, followed by a one word description of the element. GRASS data base elements are mapset subdirectories; these include: bdlg, cats, cell, cell_misc, cellhd, colr, colr2, dig, dig_ascii, dig_att, dig_cats, dig_plus, dlg, group, hist, icons, noise, paint, site_lists, and windows. The description will be used to display an error message to the screen if no files of the named element type exist in the user's mapset search path. The prompt "message" will appear in the pop-up menu displayed on the user's graphics monitor. The files listed in the menu will be of the specified element type, and exist in mapsets listed in the user's current mapset search path.

prompt=
    A brief message with which the user will be prompted. If this message contains more than one word, it should be enclosed within double quotes (""). It is a non-selectable message displayed in the menu bar of a pop-up menu. Selectable items in the displayed menu include a cancel option and any of the files in the mapset subdirectory name in the user's mapset search path.

EXAMPLE
Given the following input,

d.ask element=cell,raster prompt="raster map layer to be used"

d.ask will prompt the user to select a raster (cell) file from among those listed in the "cell" directories of the mapsets listed in his current mapset search path. A pop-up menu will be displayed on the user's graphics monitor, containing the prompt:

Double click on the raster map layer to be used Double click here to cancel

OUTPUT
If the user selects a file name from the displayed menu, d.ask writes three lines to standard output:

name=file_name mapset=mapset_name fullname=file_name@mapset_name

The output is in the form of /bin/sh commands to set the variable name to the file name specified by the user (of the element type requested by d.ask), mapset to the GRASS mapset in which this file resides, and fullname to the name of the file and its mapset.

If the user elects not to select a file but instead chooses the "Double click here to cancel" option, the mouse will be deactivated and no variable assignments will be returned to standard output.

If no files of the specified element type are found in the user's current mapset search path, the mouse is activated and the following message is displayed on the user's graphics monitor:

No element description files found Click here to continue

NOTES
Parameter values (the element name and description, and prompt message) cannot be supplied to d.ask interactively; they must be supplied on the command line or from a file.

SEE ALSO
g.ask,
g.filename,
g.findfile,
g.gisenv,
g.mapsets

BUGS
This program calls other GRASS programs which may generate confusing error messages. Example: an error message from the program d.menu will appear if a nonexistent map element is chosen.

AUTHOR
Michael Shapiro, U.S. Army Construction Engineering Research Laboratory

Last changed: $Date: 2003/04/11 09:50:53 $

Help Index