Scripting Estuary Data Mapper
Estuary Data Mapper (EDM) includes a scripting capability where short one-line text commands can control interactions with the application.
The scripting capability uses keyboard shortcuts (shown as underlined letters in the Controller window) instead of a mouse to select the various buttons and menus. Scripting enables EDM to read these keyboard shortcut commands from a plain text file.
This can be a quick and repeatable way to execute common data retrievals, run automated demos, and facilitate usage by mobility-impaired users. It is possible that a speech-to-text utility could write the commands to the plain text script file that EDM reads.
On this page:
- Download the Sample Script File
- Script File Name & Location
- Always Keep a Copy of the Script File
- Running an EDM Script File
- Running Interactive Script Commands
- Script File Format
Download the Sample Script File
Download the sample script file and customize it to your needs: edm_script.txt (txt)
The file is thoroughly commented and can serve as a reference to EDM scripting conventions.
Script File Name & Location
An EDM script file is a simple text file with a .txt extension. Create the file in Notepad (Windows) or any editor that can save the file in a plaintext format.
The script file must be saved on a computer or network drive, and then copied to edm_in.txt in the user’s home directory:
- For Windows users, this would be
C:\Users\yourusername\edm_in.txt
- For Mac/UNIX/Linux users, this would be
$HOME/edm_in.txt
Always Keep a Copy of the Script File
EDM will delete the edm_in.txt
file when it is finished, so keep a copy of the original file.
Tip: Create Multiple Script Files
Because EDM deletes the edm_in.txt
file after running, it is strongly recommended that the user keep a copy of the original script file.
Users can also create multiple script files to cover different scenarios or to repeat a frequently used sequence of commands.
To use a different script, copy one of them to $HOME/edm_in.txt
and then run the script file.
Running an EDM Script File
To run the script file:
- From a Terminal or shell window, run the command:
EstuaryDataMapper -s
to start EDM in scripting mode. EDM will look for theedm_in.txt
file and start executing the script commands. This is useful for batch (hands-free) processing. - Or launch EDM, select the Zoom Maps tab (or type 1) and select the Read Commands button or type . (a period). EDM will begin executing the script commands.
After all commands are executed, EDM deletes the edm_in.txt
file. For this reason, it is strongly recommended that the user keep a copy of the original file, or even create multiple script files.
Running Interactive Script Commands
If EDM is already running, then use any of the following ways to interactively enter one-line script commands:
- Select Zoom Maps tab or type 1. Then click the Read Commands button or press . (a period).
- On Linux, open a Terminal/shell window and run
$HOME/EDM/utils/edmcom
. - On Windows: Launch Command Prompt and run
%HOMEPATH%\EDM\utils\edmcom
.
Then, enter one-line commands into the shell window where edmcom
is running.
To stop the interactive session, either:
- Enter . (a period), or
- Press 4 then q to quit EDM.
Script File Format
Terse One-Line Commands
An EDM script file contains terse one-line commands consisting of shortcut keys (underlined as shown in the Controller GUI) for each row of buttons/menus that appear in the Controller plus some keys shown in labels.
For example, in the following screenshot, on Windows, pressing 1
opens the Zoom Maps tab, s
toggles the States map lines, g a
zooms to the Atlantic region, and z r
zooms to Rhode Island. Letter commands are case insensitive.
The script commands to select the Zoom Maps tab and then show Rhode Island’s state boundaries in the Display window would look like this:
1 # Select Map tab. z r # Zoom to Rhode Island.
(All text following the #
are comments that are ignored by EDM.)
The syntax is terse by design to match the GUI. The terseness also benefits mobility-impaired users, who may have difficulty typing or selecting commands via a mouse, and experienced users who prefer minimalist commands.
Each Line in the Script Represents a Line of UI Commands
Example: In the EDM Controller on the 2. Get Data tab, the Vulnerability commands are all on the same line in the user interface, as shown in the following screenshot:
There are no visible keyboard shortcuts to the Data Source and Variable dropdown menus (Coastal and CVI(-), in this example) since we would quickly run out of unique keys.
However, this line of Vulnerability commands can be scripted on a single line like this:
v C 2
EDM reads this line as follows:
v
= Vulnerability selection. Because this is a visible keyboard shortcut, the v is case-insensitive.C
= Coastal source. Because there is no keyboard shortcut for this button, the beginning letters as represented in the UI must be entered; Co or Coastal would also work.2
= the second variable in the dropdown menu of variable names for this data source, which in this example is CVI(-).
Specifying Dropdown Menu Selections
Specify an item in a dropdown menu by entering either:
- The number of the item as it appears in the menu (1=first item in the dropdown menu) or
- By partial beginning letter(s) match (C matches Coastal, for example).
If no value is specified in a script line, then the script defaults to the first item in the dropdown menu.
The following screenshot shows the dropdown menu listing all variables associated with the Coastal data source. To specify “Slope Risk,” the script commands could be either:
Slope Ri
to match “Slope Risk,” or16
because Slope Risk is the 16th item in the dropdown menu.
If Menu Item Names Contain Spaces
When menu source or variable names contain spaces, then use comma-delimited lines in the script.
For example, this line in the script:
v,C,Slope Ri
would be read by EDM as:
v
=vulnerabilityC
=CoastalSlope Ri
=Slope Risk