get_windows

The get_windows command is to retrieve all visible windows or dialogs in the target program. Its syntax is described in the Communication Protocol.

Arguments

  • window_type
    By default, the command retrieves all windows created using the javax.swing.JFrame base class.
    To retrieve javax.swing.JWindow instead, set window_type=window.
    To retrieve javax.swing.JDialog instead, set window_type=dialog.
  • window_title
    By default, the command retrieves all windows regardless of their titles.
    To retrieve a window with a specific title, set window_title=my target window title. Title matching is case-insensitive, and the match must be the entire string, not a part of it.
  • window_class
    By default, the command retrieves all windows regardless of their base class names.
    To retrieve a window with a specific base class name, set window_class=my.baseclass.name. Class name matching is case-sensitive. The value (my.baseclass.name for example) can be a part of or the full class name. The command will search both the Java base class (beginning with javax. or java.) and the inherited instance class for the match.
  • is_active
    By default, the command retrieves all windows regardless of whether they are active at the time.
    To retrieve only active windows, set is_active=1. The term “active” refers to the result of the isActive() method call of java.awt.Window.

Output

The output will be written to a file, following the same format as described Communication Protocol. Below is an example output generated by a get_windows command call:

javax.swing.JFrame,com.example.Window,window:0,x:162,y:109,w:700,h:550,act:0,title:Example Window
javax.swing.JFrame,com.example.Window,window:1,x:0,y:0,w:10,h:10,act:0,title:Mini Frame

Each line represents an individual window (or JFrame in the above case). For each window line, attributes are comma-delimited, and mostly follow a field_name:field_value format. The following table describes the meaning of each field:

Unnamed Attribute #1 Java base class name for the window, or the javax. or java. class that the instance class inherited from. Related argument: window_type.
Unnamed Attribute #2 Class name for the window in the target program. Related argument: window_class.
window Zero-based index for the window
x Screen coordinate x of the window
y Screen coordinate y of the window
w Width of the window
h Height of the window
act Whether the window is active (responds to the keyboard), 1 for yes and 0 for no. Related argument: is_active.
title Title of the window. Related argument: window_title.

For window_type=dialog, the output could look like this (with a JDialog):

javax.swing.JDialog,feature.configure.ah,window:0,x:182,y:129,w:768,h:576,act:1,title:Simulated Trading

Copyright © 2022 He Shiming <heshiming at gmail dot com>.