RobotJ WindowFunctions

Last Updated:

Actions for working with Window objects


[How To Read This Reference]
CloseWindow
RJ
Sends a Close command to the active window.
Maximize
RJ
Sends a WMaximize command to the active window.
Minimize
RJ
Sends a WMinimize command to the active window.
Restore
RJ
Sends a RestorePos command to the active window.
SelectMenuItem
RJ
Attempts to select a particular text string menuitem.
SelectMenuItemContains
RJ
Attempts to select a menuitem based on a partial text match.
SetPosition
RJ
Sends a SetPosition command to the window to set the position, size, and status of the window.
VerifyMenuItem
RJ
Attempts to verify the state information of a particular text string menuitem.
VerifyMenuItemContains
RJ
Attempts to verify the state information of a menuitem found by partial text match.

RobotJ WindowFunctions::CloseWindow
RJ

Sends a Close command to the active window.

This Window command has a problem in that it does not want to use the same recognition methods used by the other Window commands (like SetContext). Particularly, it does not accept the Type=Window portion of these recognition methods. In addition, if the window is a child window of a parent then it expects the ";ChildWindow" add-on in the recognition method. The child may also need the parent as part of its full recognition string like:

ChildWindow=Type=Window;<parent rec>;\;Caption=<caption>;ChildWindow

To handle these child windows, we parse the typical recognition method for our window and attempt to handle these issues. Once SetContext has successfully set our window, we then remove any "Type=Window" substring if present and add the ";ChildWindow" substring if not present.

To take advantage of this, this routine must be called with the child window as a component of the parent window like below:

t, ParentWindow, ChildWindow, CloseWindow

If the routine is called like either of the examples below then default processing will occur. This will merely SetContext on the provided Window and use "CurrentWindow" as the parameter to the command.

t, ParentWindow, ParentWindow, CloseWindow
t, ChildWindow , ChildWindow , CloseWindow (normally won't work)

Closes the "current" or "lastUsed" WebDriver associated with the found Window component.


Fields: [ ]=Optional with Default Value
    Examples:
    • T, WINDOW, WINDOW, CLOSEWINDOW
      Sends a CloseWindow command to the specified Window

      Sends a CloseWindow command to the specified Window

    [How To Read This Reference]

    RobotJ WindowFunctions::Maximize
    RJ

    Sends a WMaximize command to the active window.

    Sends a WMaximize command to the active window.

    This Window command has a problem in that it does not want to use the same recognition methods used by the other Window commands (like SetContext). Particularly, it does not accept the Type=Window portion of these recognition methods. In addition, if the window is a child window of a parent then it expects the ";ChildWindow" add-on in the recognition method. The child may also need the parent as part of its full recognition string like:

    ChildWindow=Type=Window;<parent rec>;\;Caption=<caption>;ChildWindow

    To handle these child windows, we parse the typical recognition method for our window and attempt to handle these issues. Once SetContext has successfully set our window, we then remove any "Type=Window" substring if present and add the ";ChildWindow" substring if not present.

    To take advantage of this, this routine must be called with the child window as a component of the parent window like below:

    t, ParentWindow, ChildWindow, Maximize

    If the routine is called like either of the examples below then default processing will occur. This will merely SetContext on the provided Window and use "CurrentWindow" as the parameter to the command.

    t, ParentWindow, ParentWindow, Maximize
    t, ChildWindow , ChildWindow , Maximize (normally won't work)



    Fields: [ ]=Optional with Default Value
      Examples:
      • T, WINDOW, WINDOW, MAXIMIZE
        Sends a Maximize command to the specified Window.

        Sends a Maximize command to the specified Window.

      [How To Read This Reference]

      RobotJ WindowFunctions::Minimize
      RJ

      Sends a WMinimize command to the active window.

      Sends a WMinimize command to the active window.

      This Window command has a problem in that it does not want to use the same recognition methods used by the other Window commands (like SetContext). Particularly, it does not accept the Type=Window portion of these recognition methods. In addition, if the window is a child window of a parent then it expects the ";ChildWindow" add-on in the recognition method. The child may also need the parent as part of its full recognition string like:

      ChildWindow=Type=Window;<parent rec>;\;Caption=<caption>;ChildWindow

      To handle these child windows, we parse the typical recognition method for our window and attempt to handle these issues. Once SetContext has successfully set our window, we then remove any "Type=Window" substring if present and add the ";ChildWindow" substring if not present.

      To take advantage of this, this routine must be called with the child window as a component of the parent window like below:

      t, ParentWindow, ChildWindow, Minimize

      If the routine is called like either of the examples below then default processing will occur. This will merely SetContext on the provided Window and use "CurrentWindow" as the parameter to the command.

      t, ParentWindow, ParentWindow, Minimize
      t, ChildWindow , ChildWindow , Minimize (normally won't work)



      Fields: [ ]=Optional with Default Value
        Examples:
        • T, WINDOW, WINDOW, MINIMIZE
          Sends a Minimize command to the specified Window.

          Sends a Minimize command to the specified Window.

        [How To Read This Reference]

        RobotJ WindowFunctions::Restore
        RJ

        Sends a RestorePos command to the active window.

        Sends a RestorePos command to the active window.

        This Window command has a problem in that it does not want to use the same recognition methods used by the other Window commands (like SetContext). Particularly, it does not accept the Type=Window portion of these recognition methods. In addition, if the window is a child window of a parent then it expects the ";ChildWindow" add-on in the recognition method. The child may also need the parent as part of its full recognition string like:

        ChildWindow=Type=Window;<parent rec>;\;Caption=<caption>;ChildWindow

        To handle these child windows, we parse the typical recognition method for our window and attempt to handle these issues. Once SetContext has successfully set our window, we then remove any "Type=Window" substring if present and add the ";ChildWindow" substring if not present.

        To take advantage of this, this routine must be called with the child window as a component of the parent window like below:

        t, ParentWindow, ChildWindow, Restore

        If the routine is called like either of the examples below then default processing will occur. This will merely SetContext on the provided Window and use "CurrentWindow" as the parameter to the command.

        t, ParentWindow, ParentWindow, Restore
        t, ChildWindow , ChildWindow , Restore (normally won't work)



        Fields: [ ]=Optional with Default Value
          Examples:
          • T, WINDOW, WINDOW, RESTORE
            Sends a Restore command to the specified Window.

            Sends a Restore command to the specified Window.

          [How To Read This Reference]

          RobotJ WindowFunctions::SelectMenuItem
          RJ

          Attempts to select a particular text string menuitem.

          Attempts to select a particular text string menuitem. The menuitem should be specified in the form "Menu->Menu->MenuItem CTRL+V" with the full text, spaces(if any), and keyboard shortcut text (if any).

          Ampersands preceding underlined characters are optional. The routine first verifies that the specified menuitem exists and exits with error if it does not. If it does exist then the selection proceeds using the MenuID retrieved from the found menuitem.



          Fields: [ ]=Optional with Default Value
          1. TextValue
            Menu->MenuItem hierarchy string to identify which menuitem to select.

            Menu->MenuItem hierarchy string to identify which menuitem to select. NOTE:RC (Robot) can only handle submenus up to 5 levels deep.

          Examples:
          • T, WINDOW, WINDOW, SELECTMENUITEM, "&File->&Save Ctrl+S"
            This actions selects the Save menuitem under the File menu pulldown.

            Field 5 : TQ String. the full case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The text must include the full text including spaces and any visible shortcut key combinations displayed in the text of the menu item. The menu does not have to be open to issue the command. Just issue the command from a normal state. This command only works if the Window implements standard menus. Use InputKeys or Window Click commands to use non-standard menus or to navigate individual menu panels.

          • T, PopupMenu, PopupMenu, SELECTMENUITEM, "Exit"
            This actions selects the Exit menuitem from an exposed File popup menu.

            Field 5 : TQ String. the full case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The text must include the full text including spaces and any visible shortcut key combinations displayed in the text of the menu item. For a popup menu, the menu does have to be exposed to be found. This command only works if the Window implements standard menus. Use InputKeys or Window Click commands to use non-standard menus or to navigate individual menu panels.

          [How To Read This Reference]

          RobotJ WindowFunctions::SelectMenuItemContains
          RJ

          Attempts to select a menuitem based on a partial text match.

          Attempts to select a menuitem based on a partial text match. The menuitem should be specified in the form "Menu->Menu->MenuItem". Each level in the hierarchy can be represented by partial text.

          Ampersands preceding underlined characters are optional. The routine first verifies that the specified menuitem exists and exits with error if it does not. If it does exist then the selection proceeds using the MenuID retrieved from the found menuitem.



          Fields: [ ]=Optional with Default Value
          1. TextValue
            Menu->MenuItem hierarchy string to identify which menuitem to select.

            Menu->MenuItem hierarchy string to identify which menuitem to select. NOTE:RC (Robot) can only handle submenus up to 5 levels deep.

          Examples:
          • T, WINDOW, WINDOW, SELECTMENUITEMCONTAINS, "&File->&Save"
            This actions selects the Save menuitem under the File menu pulldown.

            Field 5 : TQ String. the case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The menu does not have to be open to issue the command. Just issue the command from a normal state. This command only works if the Window implements standard menus. Use InputKeys or Window Click commands to use non-standard menus or to navigate individual menu panels.

          • T, PopupMenu, PopupMenu, SELECTMENUITEMCONTAINS, "x"
            This actions selects the Exit menuitem from an exposed File popup menu.

            Field 5 : TQ String. the case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. For a popup menu the menu does have to be exposed to be able to select its menuitems. This command only works if the Window implements standard menus. Use InputKeys or Window Click commands to use non-standard menus or to navigate individual menu panels.

          [How To Read This Reference]

          RobotJ WindowFunctions::SetPosition
          RJ

          Sends a SetPosition command to the window to set the position, size, and status of the window.

          Sends a SetPosition command to the window to set the position, size, and status of the window. The position, size, and status information is stored in the app map as a subitem in the section for the window. The information should be in the format of:

          "0,0,640,480;Status=NORMAL" OR "Coords=0,0,640,480;Status=NORMAL"

          That example positions the window at 0,0; sizes it to 640 x 480, and sets it's status to NORMAL. Valid values for STATUS are:

          NORMAL, MINIMIZED, and MAXIMIZED

          The Window SetPosition command has a problem in that it does not want to use the same recognition methods used by the other Window commands (like SetContext). Particularly, it does not accept the Type=Window portion of these recognition methods. In addition, if the window is a child window of a parent then it expects the ";ChildWindow" add-on in the recognition method. The child may also need the parent as part of its full recognition string like:

          ChildWindow=Type=Window;<parent rec>;\;Caption=<caption>;ChildWindow

          To handle these child windows, we parse the typical recognition method for our window and attempt to handle these issues. Once SetContext has successfully set our window, we then remove any "Type=Window" substring if present and add the ";ChildWindow" substring if not present.

          To take advantage of this, this routine must be called with the child window as a component of the parent window like below:

          t, ParentWindow, ChildWindow, SetPosition, ChildPositionReference

          If the routine is called like either of the examples below then default processing will occur. This will merely SetContext on the provided Window and use "CurrentWindow" as the parameter to SetPosition.

          t, ParentWindow, ParentWindow, SetPosition, ParentPosition
          t, ChildWindow , ChildWindow , SetPosition, ChildPosition (normally won't work)



          Fields: [ ]=Optional with Default Value
          1. PresetReference
            String specifying a preset reference in the Application for the position, size, and state of the Window.

            String specifying a preset reference in the Application for the position, size, and state of the Window. command.

          Examples:
          • T, WINDOW, WINDOW, SETPOSITION, Preset1
            Preset1 specifies a preset reference in the Application for the position, size, and state of the Window.

            Field 5 : TQ String specifying a preset reference in the Application for the position, size, and state of the Window.

          [How To Read This Reference]

          RobotJ WindowFunctions::VerifyMenuItem
          RJ

          Attempts to verify the state information of a particular text string menuitem.

          Attempts to verify the state information of a particular text string menuitem. The menuitem should be specified in the form "Menu->Menu->MenuItem CTRL+V" with the full text (ampersands optional), spaces(if any), and keyboard shortcut text (if any). (The ampersands precede any character in the menuitem that is underlined.)

          Note 1: This command differs from JavaMenuFunctions.VerifyMenuItemContains as this command seeks a Window object that contains a Window's menu.

          Note 2: For RobotJ engine, this command only supports JavaSwing. It may support other clients in the future.



          Fields: [ ]=Optional with Default Value
          1. MenuItemText
            Menu->MenuItem hierarchy string to identify which menuitem to test.

            Menu->MenuItem hierarchy string to identify which menuitem to test. This menu hierarchy IS case-sensitive

          2. ExpectedStatus
            Expected status string (or part thereof) to verify.

            Expected status string (or part thereof) to verify. Ex: "Enabled Checked" OR "Disabled Grayed" etc. Each item separated by a space will be evaluated separately so the order of the status items does not matter. These status items ARE case-sensitive.

          Examples:
          • T, WINDOW, WINDOW, VERIFYMENUITEM, "File","Enabled Menu With 7 MenuItems"
            This action verifies that "File" is enabled and contains 7 menuitems.

            Field 5 : TQ String. the full case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The text must include the full text including spaces and any visible shortcut key combinations displayed in the text of the menu item.

            Field 6 : QS String. The case-sensitive, space-delimited, double-quote enclosed status information needing verification. Only the state information of interest needs to be specified.



          [How To Read This Reference]

          RobotJ WindowFunctions::VerifyMenuItemContains
          RJ

          Attempts to verify the state information of a menuitem found by partial text match.

          Attempts to verify the state information of a menuitem found by partial text match. The menuitem should be specified in the form "Menu->Menu->MenuItem". (Optional ampersands precede any character in the menuitem that is underlined.)

          Note 1: This command differs from JavaMenuFunctions.VerifyMenuItemContains as this command seeks a Window object that contains a Window's menu.

          Note 2: For RobotJ engine, this command only supports JavaSwing. It may support other clients in the future.



          Fields: [ ]=Optional with Default Value
          1. MenuItemText
            Menu->MenuItem hierarchy string to identify which menuitem to test.

            Menu->MenuItem hierarchy string to identify which menuitem to test. This menu hierarchy IS case-sensitive

          2. ExpectedStatus
            Expected status string (or part thereof) to verify.

            Expected status string (or part thereof) to verify. Ex: "Enabled Checked" OR "Disabled Grayed" etc. Each item separated by a space will be evaluated separately so the order of the status items does not matter. These status items ARE case-sensitive.

          Examples:
          • T, WINDOW, WINDOW, VERIFYMENUITEMCONTAINS, "File->Save","Enabled"
            This action verifies that menuitem "File/Save" is enabled.

            Field 5 : TQ String. the case-sensitive menu item path to select. Ampersands (&) indicating/preceding underlined characters are optional. The text can be any substring of the full text including spaces and any visible shortcut key combinations displayed in the text of the menu item.

            Field 6 : QS String. The case-sensitive, space-delimited, double-quote enclosed status information needing verification. Only the state information of interest needs to be specified.



          [How To Read This Reference]