Get the position and size of a window
When you automate windows and desktop applications, you may need to know the exact position and size of a window.
To retrieve this information, use the Get details of window action and set the Window property option to Get window location and size. The action stores the retrieved values in a text variable named WindowProperty.
The Get details of window action requires a UI element that specifies the window from which it will retrieve the selected attrubite. You can find more information regarding UI elements in Automate using UI elements.
After retrieving the WindowProperty text value, you have to split it into separate values and convert them to numbers.
To split the text value, deploy the Split text action and separate the values using the comma character (,) as a delimiter. The separated values are stored in a list variable named TextList.
Before converting the texts to numbers, use the Create new list action to create a list that will store the converted numbers in the following steps.
To access each item of the TextList independently, deploy a For each loop.
Inside the loop, use a Convert text to number action to convert the current text item of the loop to number.
Next, use the Add item to list action to store the produced number to the previously created list.
To access the final position and size values later in your flow, use the following notations:
- List - The left point of the window
- List - The top point of the window
- List - The width of the window
- List - the height of the window
To calculate the right and bottom points of the window, you can use the following expressions:
- %List + List% - The right point of the window
- %List + List% - The bottom point of the window
You can find more information about lists and the VariableName[ItemNumber] notation in Variable datatypes.
Submit and view feedback for