Skip to content

Gui scripting

MaartenHilferink edited this page May 8, 2026 · 5 revisions

The GeoDMS GUI (GeoDmsGuiQt.exe) can replay a script of GUI actions, primarily used for automated regression and release testing. The implementation lives in qtgui/exe/src/TestScript.cpp (parser + dispatch) and the matching command codes in qtgui/exe/src/TestScript.h.

invocation

Pass a script file via the /T command-line switch (no space between /T and the path):

GeoDmsGuiQt.exe /TC:\path\to\my.script C:\path\to\config.dms

The script runs on the main (GUI) thread after the main window is shown. Each line is executed sequentially; a script line is dispatched as a single posted operation, so commands take effect in the same event-loop turn.

file format

Scripts are plain text, parsed one line at a time:

element rule
line terminator \n (LF). Carriage returns and other whitespace are tolerated by the tokenizer.
comment // starts a comment; the rest of the line is ignored. There is no block-comment syntax.
empty line skipped.
token separator any whitespace (isspace) between tokens.
quoted token "..." keeps a single token together up to the next "; the surrounding quotes are stripped. Use this for paths or names that contain spaces.
max tokens per line 20 (MAX_ARG_COUNT). Excess tokens on a line are silently ignored.

Multiple commands may appear on the same line — the dispatcher iterates over the tokens and executes each command in turn. The exception is WAIT, which returns immediately and pauses before the next line is read.

commands

Token matching is case-sensitive. Where two names appear, both are accepted.

command arguments effect
WAIT <milliseconds> Pause script execution for the given number of milliseconds before processing the next line. (Note: the source error message labels the argument "seconds", but it is actually consumed as milliseconds.)
DefaultView Open the default view for the currently active tree item (same as the toolbar default-view action).
GOTO / ActivateItem <item-path> Set the active tree item to the given DMS path (e.g. /SomeContainer/SomeItem). Quote paths that contain spaces.
EXPAND / Expand Expand the currently active tree node by one level.
Collapse Collapse the currently active tree node.
ExpandAll Expand the entire tree.
ExpandRecursive Recursively expand from the current item downward.
DP / ShowDetailPage <page-number> Switch the detail-pages panel to a specific page (see table below).
SAVE_DP / SaveDetailPage <file-path> Save the current detail page contents to a file.
CascadeSubWindows Cascade the MDI sub-windows.
TileSubWindows Tile the MDI sub-windows.
SaveValueInfo <file-path> Save the current ValueInfo content to a file.
SEND <code> <count> [<dword>...] Low-level escape hatch: post a WM_COPYDATA message with command code <code> and <count> 32-bit unsigned integers as payload. Used for actions not yet wrapped by a named keyword.

Unrecognised tokens are reported on stderr (Unrecognized keyword: <token>) and skipped; the script continues with the next token.

detail-page numbers

Used as the argument to ShowDetailPage / DP. Values come from the ActiveDetailPage enum in qtgui/exe/src/DmsDetailPages.h:

value page
0 GENERAL
1 EXPLORE
2 PROPERTIES
3 CONFIGURATION
4 SOURCEDESCR
5 METADATA
6 STATISTICS
7 VALUE_INFO
8 NONE

SEND command codes

The SEND keyword takes a numeric command code matching the CommandCode enum (qtgui/exe/src/TestScript.h). The dedicated keywords listed above are preferred; codes are documented for completeness.

code name notes
0 SendApp Send a Windows message without an explicit HWND. Payload: {message, wParam, lParam}.
1 SendMain Send to the main window. Payload: {message, wParam, lParam}.
2 SendFocus Send to the currently focused window. Payload: {message, wParam, lParam}.
3 SendActiveDmsControl Send to the active DMS view-area HWND. Payload: {message, wParam, lParam}.
4 WmCopyActiveDmsControl Send a WM_COPYDATA to the active DMS view. Payload: {cmd, data...}.
5 DefaultView Equivalent to the DefaultView keyword.
6 ActivateItem Equivalent to ActivateItem.
7 miExportViewPorts Export viewports menu action (currently a stub on Qt).
8 Expand Payload {1} expand, {0} collapse.
9 ShowDetailPage Payload {pageNumber}.
10 SaveDetailPage Payload: zero-terminated path.
11 miDatagridView Datagrid-view menu action (stub).
12 miHistogramView Histogram-view menu action (stub).
13 CascadeSubWindows
14 TileSubWindows
15 ExpandAll
16 ExpandRecursive
17 SaveValueInfo Payload: zero-terminated path.

linux

On non-Windows builds, the same command vocabulary works, but commands are invoked by direct method calls on the main window rather than through WM_COPYDATA. Most SEND codes are not implemented on Linux; only WM_CLOSE (via SendMain with message 16), WM_KEYDOWN (256), WM_CHAR (258), and WM_COMMAND (273) are dispatched, plus WmCopyActiveDmsControl data forwarded to DataView::OnCopyData.

example

// open a configuration first via the command line; the script drives the GUI from there.
ActivateItem  /SomeContainer/SomeItem
ExpandRecursive
WAIT          250
ShowDetailPage 5                      // METADATA
SaveDetailPage "C:\TestOut\meta.html"
DefaultView
WAIT          1000
SaveValueInfo "C:\TestOut\valueinfo.html"
TileSubWindows

requested / not yet implemented

Items previously listed as desired GUI-scripting capabilities, not yet wired up:

  • Goto cell in table
  • Activate ValueInfo (for active cell in table)
  • Select range of cells
  • Copy active range to clipboard

see also

  • Release Testing System — uses GUI scripts in t1630, t1640, t1642 regression tests.
  • qtgui/exe/src/TestScript.cpp / TestScript.h — authoritative implementation.

Clone this wiki locally