partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
Bitmap.GetPixelColorsHorizontally
x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y horizontally.
uiautomation/uiautomation.py
def GetPixelColorsHorizontally(self, x: int, y: int, count: int) -> ctypes.Array: """ x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y horizontally. """ arrayType = ctypes.c_uint32 * count values = arrayType() _DllClient.instance().dll.BitmapGetPixelsHorizontally(ctypes.c_size_t(self._bitmap), x, y, values, count) return values
def GetPixelColorsHorizontally(self, x: int, y: int, count: int) -> ctypes.Array: """ x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y horizontally. """ arrayType = ctypes.c_uint32 * count values = arrayType() _DllClient.instance().dll.BitmapGetPixelsHorizontally(ctypes.c_size_t(self._bitmap), x, y, values, count) return values
[ "x", ":", "int", ".", "y", ":", "int", ".", "count", ":", "int", ".", "Return", "ctypes", ".", "Array", "an", "iterable", "array", "of", "int", "values", "in", "argb", "form", "point", "x", "y", "horizontally", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3056-L3066
[ "def", "GetPixelColorsHorizontally", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "count", ":", "int", ")", "->", "ctypes", ".", "Array", ":", "arrayType", "=", "ctypes", ".", "c_uint32", "*", "count", "values", "=", "arrayType", "(", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.SetPixelColorsHorizontally
Set pixel colors form x,y horizontally. x: int. y: int. colors: Iterable, an iterable list of int color values in argb. Return bool, True if succeed otherwise False.
uiautomation/uiautomation.py
def SetPixelColorsHorizontally(self, x: int, y: int, colors: Iterable) -> bool: """ Set pixel colors form x,y horizontally. x: int. y: int. colors: Iterable, an iterable list of int color values in argb. Return bool, True if succeed otherwise False. """ count = len(colors) arrayType = ctypes.c_uint32 * count values = arrayType(*colors) return _DllClient.instance().dll.BitmapSetPixelsHorizontally(ctypes.c_size_t(self._bitmap), x, y, values, count)
def SetPixelColorsHorizontally(self, x: int, y: int, colors: Iterable) -> bool: """ Set pixel colors form x,y horizontally. x: int. y: int. colors: Iterable, an iterable list of int color values in argb. Return bool, True if succeed otherwise False. """ count = len(colors) arrayType = ctypes.c_uint32 * count values = arrayType(*colors) return _DllClient.instance().dll.BitmapSetPixelsHorizontally(ctypes.c_size_t(self._bitmap), x, y, values, count)
[ "Set", "pixel", "colors", "form", "x", "y", "horizontally", ".", "x", ":", "int", ".", "y", ":", "int", ".", "colors", ":", "Iterable", "an", "iterable", "list", "of", "int", "color", "values", "in", "argb", ".", "Return", "bool", "True", "if", "succ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3068-L3079
[ "def", "SetPixelColorsHorizontally", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "colors", ":", "Iterable", ")", "->", "bool", ":", "count", "=", "len", "(", "colors", ")", "arrayType", "=", "ctypes", ".", "c_uint32", "*", "count", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetPixelColorsVertically
x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y vertically.
uiautomation/uiautomation.py
def GetPixelColorsVertically(self, x: int, y: int, count: int) -> ctypes.Array: """ x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y vertically. """ arrayType = ctypes.c_uint32 * count values = arrayType() _DllClient.instance().dll.BitmapGetPixelsVertically(ctypes.c_size_t(self._bitmap), x, y, values, count) return values
def GetPixelColorsVertically(self, x: int, y: int, count: int) -> ctypes.Array: """ x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y vertically. """ arrayType = ctypes.c_uint32 * count values = arrayType() _DllClient.instance().dll.BitmapGetPixelsVertically(ctypes.c_size_t(self._bitmap), x, y, values, count) return values
[ "x", ":", "int", ".", "y", ":", "int", ".", "count", ":", "int", ".", "Return", "ctypes", ".", "Array", "an", "iterable", "array", "of", "int", "values", "in", "argb", "form", "point", "x", "y", "vertically", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3081-L3091
[ "def", "GetPixelColorsVertically", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "count", ":", "int", ")", "->", "ctypes", ".", "Array", ":", "arrayType", "=", "ctypes", ".", "c_uint32", "*", "count", "values", "=", "arrayType", "(", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetPixelColorsOfRow
y: int, row index. Return `ctypes.Array`, an iterable array of int values in argb of y row.
uiautomation/uiautomation.py
def GetPixelColorsOfRow(self, y: int) -> ctypes.Array: """ y: int, row index. Return `ctypes.Array`, an iterable array of int values in argb of y row. """ return self.GetPixelColorsOfRect(0, y, self.Width, 1)
def GetPixelColorsOfRow(self, y: int) -> ctypes.Array: """ y: int, row index. Return `ctypes.Array`, an iterable array of int values in argb of y row. """ return self.GetPixelColorsOfRect(0, y, self.Width, 1)
[ "y", ":", "int", "row", "index", ".", "Return", "ctypes", ".", "Array", "an", "iterable", "array", "of", "int", "values", "in", "argb", "of", "y", "row", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3106-L3111
[ "def", "GetPixelColorsOfRow", "(", "self", ",", "y", ":", "int", ")", "->", "ctypes", ".", "Array", ":", "return", "self", ".", "GetPixelColorsOfRect", "(", "0", ",", "y", ",", "self", ".", "Width", ",", "1", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetPixelColorsOfColumn
x: int, column index. Return `ctypes.Array`, an iterable array of int values in argb of x column.
uiautomation/uiautomation.py
def GetPixelColorsOfColumn(self, x: int) -> ctypes.Array: """ x: int, column index. Return `ctypes.Array`, an iterable array of int values in argb of x column. """ return self.GetPixelColorsOfRect(x, 0, 1, self.Height)
def GetPixelColorsOfColumn(self, x: int) -> ctypes.Array: """ x: int, column index. Return `ctypes.Array`, an iterable array of int values in argb of x column. """ return self.GetPixelColorsOfRect(x, 0, 1, self.Height)
[ "x", ":", "int", "column", "index", ".", "Return", "ctypes", ".", "Array", "an", "iterable", "array", "of", "int", "values", "in", "argb", "of", "x", "column", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3113-L3118
[ "def", "GetPixelColorsOfColumn", "(", "self", ",", "x", ":", "int", ")", "->", "ctypes", ".", "Array", ":", "return", "self", ".", "GetPixelColorsOfRect", "(", "x", ",", "0", ",", "1", ",", "self", ".", "Height", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetPixelColorsOfRect
x: int. y: int. width: int. height: int. Return `ctypes.Array`, an iterable array of int values in argb of the input rect.
uiautomation/uiautomation.py
def GetPixelColorsOfRect(self, x: int, y: int, width: int, height: int) -> ctypes.Array: """ x: int. y: int. width: int. height: int. Return `ctypes.Array`, an iterable array of int values in argb of the input rect. """ arrayType = ctypes.c_uint32 * (width * height) values = arrayType() _DllClient.instance().dll.BitmapGetPixelsOfRect(ctypes.c_size_t(self._bitmap), x, y, width, height, values) return values
def GetPixelColorsOfRect(self, x: int, y: int, width: int, height: int) -> ctypes.Array: """ x: int. y: int. width: int. height: int. Return `ctypes.Array`, an iterable array of int values in argb of the input rect. """ arrayType = ctypes.c_uint32 * (width * height) values = arrayType() _DllClient.instance().dll.BitmapGetPixelsOfRect(ctypes.c_size_t(self._bitmap), x, y, width, height, values) return values
[ "x", ":", "int", ".", "y", ":", "int", ".", "width", ":", "int", ".", "height", ":", "int", ".", "Return", "ctypes", ".", "Array", "an", "iterable", "array", "of", "int", "values", "in", "argb", "of", "the", "input", "rect", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3120-L3131
[ "def", "GetPixelColorsOfRect", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ")", "->", "ctypes", ".", "Array", ":", "arrayType", "=", "ctypes", ".", "c_uint32", "*", "(", "width", "*"...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.SetPixelColorsOfRect
x: int. y: int. width: int. height: int. colors: Iterable, an iterable list of int values, it's length must equal to width*height. Return `ctypes.Array`, an iterable array of int values in argb of the input rect.
uiautomation/uiautomation.py
def SetPixelColorsOfRect(self, x: int, y: int, width: int, height: int, colors: Iterable) -> bool: """ x: int. y: int. width: int. height: int. colors: Iterable, an iterable list of int values, it's length must equal to width*height. Return `ctypes.Array`, an iterable array of int values in argb of the input rect. """ arrayType = ctypes.c_uint32 * (width * height) values = arrayType(*colors) return bool(_DllClient.instance().dll.BitmapSetPixelsOfRect(ctypes.c_size_t(self._bitmap), x, y, width, height, values))
def SetPixelColorsOfRect(self, x: int, y: int, width: int, height: int, colors: Iterable) -> bool: """ x: int. y: int. width: int. height: int. colors: Iterable, an iterable list of int values, it's length must equal to width*height. Return `ctypes.Array`, an iterable array of int values in argb of the input rect. """ arrayType = ctypes.c_uint32 * (width * height) values = arrayType(*colors) return bool(_DllClient.instance().dll.BitmapSetPixelsOfRect(ctypes.c_size_t(self._bitmap), x, y, width, height, values))
[ "x", ":", "int", ".", "y", ":", "int", ".", "width", ":", "int", ".", "height", ":", "int", ".", "colors", ":", "Iterable", "an", "iterable", "list", "of", "int", "values", "it", "s", "length", "must", "equal", "to", "width", "*", "height", ".", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3133-L3144
[ "def", "SetPixelColorsOfRect", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ",", "colors", ":", "Iterable", ")", "->", "bool", ":", "arrayType", "=", "ctypes", ".", "c_uint32", "*", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetPixelColorsOfRects
rects: a list of rects, such as [(0,0,10,10), (10,10,20,20),(x,y,width,height)]. Return list, a list whose elements are ctypes.Array which is an iterable array of int values in argb.
uiautomation/uiautomation.py
def GetPixelColorsOfRects(self, rects: list) -> list: """ rects: a list of rects, such as [(0,0,10,10), (10,10,20,20),(x,y,width,height)]. Return list, a list whose elements are ctypes.Array which is an iterable array of int values in argb. """ rects2 = [(x, y, x + width, y + height) for x, y, width, height in rects] left, top, right, bottom = zip(*rects2) left, top, right, bottom = min(left), min(top), max(right), max(bottom) width, height = right - left, bottom - top allColors = self.GetPixelColorsOfRect(left, top, width, height) colorsOfRects = [] for x, y, w, h in rects: x -= left y -= top colors = [] for row in range(h): colors.extend(allColors[(y + row) * width + x:(y + row) * width + x + w]) colorsOfRects.append(colors) return colorsOfRects
def GetPixelColorsOfRects(self, rects: list) -> list: """ rects: a list of rects, such as [(0,0,10,10), (10,10,20,20),(x,y,width,height)]. Return list, a list whose elements are ctypes.Array which is an iterable array of int values in argb. """ rects2 = [(x, y, x + width, y + height) for x, y, width, height in rects] left, top, right, bottom = zip(*rects2) left, top, right, bottom = min(left), min(top), max(right), max(bottom) width, height = right - left, bottom - top allColors = self.GetPixelColorsOfRect(left, top, width, height) colorsOfRects = [] for x, y, w, h in rects: x -= left y -= top colors = [] for row in range(h): colors.extend(allColors[(y + row) * width + x:(y + row) * width + x + w]) colorsOfRects.append(colors) return colorsOfRects
[ "rects", ":", "a", "list", "of", "rects", "such", "as", "[", "(", "0", "0", "10", "10", ")", "(", "10", "10", "20", "20", ")", "(", "x", "y", "width", "height", ")", "]", ".", "Return", "list", "a", "list", "whose", "elements", "are", "ctypes",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3146-L3164
[ "def", "GetPixelColorsOfRects", "(", "self", ",", "rects", ":", "list", ")", "->", "list", ":", "rects2", "=", "[", "(", "x", ",", "y", ",", "x", "+", "width", ",", "y", "+", "height", ")", "for", "x", ",", "y", ",", "width", ",", "height", "in...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetAllPixelColors
Return `ctypes.Array`, an iterable array of int values in argb.
uiautomation/uiautomation.py
def GetAllPixelColors(self) -> ctypes.Array: """ Return `ctypes.Array`, an iterable array of int values in argb. """ return self.GetPixelColorsOfRect(0, 0, self.Width, self.Height)
def GetAllPixelColors(self) -> ctypes.Array: """ Return `ctypes.Array`, an iterable array of int values in argb. """ return self.GetPixelColorsOfRect(0, 0, self.Width, self.Height)
[ "Return", "ctypes", ".", "Array", "an", "iterable", "array", "of", "int", "values", "in", "argb", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3166-L3170
[ "def", "GetAllPixelColors", "(", "self", ")", "->", "ctypes", ".", "Array", ":", "return", "self", ".", "GetPixelColorsOfRect", "(", "0", ",", "0", ",", "self", ".", "Width", ",", "self", ".", "Height", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Bitmap.GetSubBitmap
x: int. y: int. width: int. height: int. Return `Bitmap`, a sub bitmap of the input rect.
uiautomation/uiautomation.py
def GetSubBitmap(self, x: int, y: int, width: int, height: int) -> 'Bitmap': """ x: int. y: int. width: int. height: int. Return `Bitmap`, a sub bitmap of the input rect. """ colors = self.GetPixelColorsOfRect(x, y, width, height) bitmap = Bitmap(width, height) bitmap.SetPixelColorsOfRect(0, 0, width, height, colors) return bitmap
def GetSubBitmap(self, x: int, y: int, width: int, height: int) -> 'Bitmap': """ x: int. y: int. width: int. height: int. Return `Bitmap`, a sub bitmap of the input rect. """ colors = self.GetPixelColorsOfRect(x, y, width, height) bitmap = Bitmap(width, height) bitmap.SetPixelColorsOfRect(0, 0, width, height, colors) return bitmap
[ "x", ":", "int", ".", "y", ":", "int", ".", "width", ":", "int", ".", "height", ":", "int", ".", "Return", "Bitmap", "a", "sub", "bitmap", "of", "the", "input", "rect", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3172-L3183
[ "def", "GetSubBitmap", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ")", "->", "'Bitmap'", ":", "colors", "=", "self", ".", "GetPixelColorsOfRect", "(", "x", ",", "y", ",", "width", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
CustomNavigationPattern.Navigate
Call IUIAutomationCustomNavigationPattern::Navigate. Get the next control in the specified direction within the logical UI tree. direction: int, a value in class `NavigateDirection`. Return `Control` subclass or None. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationcustomnavigationpattern-navigate
uiautomation/uiautomation.py
def Navigate(self, direction: int) -> 'Control': """ Call IUIAutomationCustomNavigationPattern::Navigate. Get the next control in the specified direction within the logical UI tree. direction: int, a value in class `NavigateDirection`. Return `Control` subclass or None. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationcustomnavigationpattern-navigate """ ele = self.pattern.Navigate(direction) return Control.CreateControlFromElement(ele)
def Navigate(self, direction: int) -> 'Control': """ Call IUIAutomationCustomNavigationPattern::Navigate. Get the next control in the specified direction within the logical UI tree. direction: int, a value in class `NavigateDirection`. Return `Control` subclass or None. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationcustomnavigationpattern-navigate """ ele = self.pattern.Navigate(direction) return Control.CreateControlFromElement(ele)
[ "Call", "IUIAutomationCustomNavigationPattern", "::", "Navigate", ".", "Get", "the", "next", "control", "in", "the", "specified", "direction", "within", "the", "logical", "UI", "tree", ".", "direction", ":", "int", "a", "value", "in", "class", "NavigateDirection",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3349-L3358
[ "def", "Navigate", "(", "self", ",", "direction", ":", "int", ")", "->", "'Control'", ":", "ele", "=", "self", ".", "pattern", ".", "Navigate", "(", "direction", ")", "return", "Control", ".", "CreateControlFromElement", "(", "ele", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
DockPattern.SetDockPosition
Call IUIAutomationDockPattern::SetDockPosition. dockPosition: int, a value in class `DockPosition`. waitTime: float. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdockpattern-setdockposition
uiautomation/uiautomation.py
def SetDockPosition(self, dockPosition: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationDockPattern::SetDockPosition. dockPosition: int, a value in class `DockPosition`. waitTime: float. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdockpattern-setdockposition """ ret = self.pattern.SetDockPosition(dockPosition) time.sleep(waitTime) return ret
def SetDockPosition(self, dockPosition: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationDockPattern::SetDockPosition. dockPosition: int, a value in class `DockPosition`. waitTime: float. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdockpattern-setdockposition """ ret = self.pattern.SetDockPosition(dockPosition) time.sleep(waitTime) return ret
[ "Call", "IUIAutomationDockPattern", "::", "SetDockPosition", ".", "dockPosition", ":", "int", "a", "value", "in", "class", "DockPosition", ".", "waitTime", ":", "float", ".", "Refer", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3376-L3385
[ "def", "SetDockPosition", "(", "self", ",", "dockPosition", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "int", ":", "ret", "=", "self", ".", "pattern", ".", "SetDockPosition", "(", "dockPosition", ")", "time", ".", "sl...
2cc91060982cc8b777152e698d677cc2989bf263
valid
DragPattern.GetGrabbedItems
Call IUIAutomationDragPattern::GetCurrentGrabbedItems. Return list, a list of `Control` subclasses that represent the full set of items that the user is dragging as part of a drag operation. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdragpattern-getcurrentgrabbeditems
uiautomation/uiautomation.py
def GetGrabbedItems(self) -> list: """ Call IUIAutomationDragPattern::GetCurrentGrabbedItems. Return list, a list of `Control` subclasses that represent the full set of items that the user is dragging as part of a drag operation. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdragpattern-getcurrentgrabbeditems """ eleArray = self.pattern.GetCurrentGrabbedItems() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetGrabbedItems(self) -> list: """ Call IUIAutomationDragPattern::GetCurrentGrabbedItems. Return list, a list of `Control` subclasses that represent the full set of items that the user is dragging as part of a drag operation. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationdragpattern-getcurrentgrabbeditems """ eleArray = self.pattern.GetCurrentGrabbedItems() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationDragPattern", "::", "GetCurrentGrabbedItems", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "that", "represent", "the", "full", "set", "of", "items", "that", "the", "user", "is", "dragging", "as", "part", "of", "a", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3425-L3441
[ "def", "GetGrabbedItems", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentGrabbedItems", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Length", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
ExpandCollapsePattern.Expand
Call IUIAutomationExpandCollapsePattern::Expand. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationexpandcollapsepattern-collapse
uiautomation/uiautomation.py
def Expand(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationExpandCollapsePattern::Expand. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationexpandcollapsepattern-collapse """ ret = self.pattern.Expand() == S_OK time.sleep(waitTime) return ret
def Expand(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationExpandCollapsePattern::Expand. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationexpandcollapsepattern-collapse """ ret = self.pattern.Expand() == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationExpandCollapsePattern", "::", "Expand", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", ".", "Refer", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", "us", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3499-L3508
[ "def", "Expand", "(", "self", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Expand", "(", ")", "==", "S_OK", "time", ".", "sleep", "(", "waitTime", ")", "return", "ret" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
ItemContainerPattern.FindItemByProperty
Call IUIAutomationItemContainerPattern::FindItemByProperty. control: `Control` or its subclass. propertyValue: COM VARIANT according to propertyId? todo. propertyId: int, a value in class `PropertyId`. Return `Control` subclass, a control within a containing element, based on a specified property value. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationitemcontainerpattern-finditembyproperty
uiautomation/uiautomation.py
def FindItemByProperty(control: 'Control', propertyId: int, propertyValue) -> 'Control': """ Call IUIAutomationItemContainerPattern::FindItemByProperty. control: `Control` or its subclass. propertyValue: COM VARIANT according to propertyId? todo. propertyId: int, a value in class `PropertyId`. Return `Control` subclass, a control within a containing element, based on a specified property value. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationitemcontainerpattern-finditembyproperty """ ele = self.pattern.FindItemByProperty(control.Element, propertyId, propertyValue) return Control.CreateControlFromElement(ele)
def FindItemByProperty(control: 'Control', propertyId: int, propertyValue) -> 'Control': """ Call IUIAutomationItemContainerPattern::FindItemByProperty. control: `Control` or its subclass. propertyValue: COM VARIANT according to propertyId? todo. propertyId: int, a value in class `PropertyId`. Return `Control` subclass, a control within a containing element, based on a specified property value. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationitemcontainerpattern-finditembyproperty """ ele = self.pattern.FindItemByProperty(control.Element, propertyId, propertyValue) return Control.CreateControlFromElement(ele)
[ "Call", "IUIAutomationItemContainerPattern", "::", "FindItemByProperty", ".", "control", ":", "Control", "or", "its", "subclass", ".", "propertyValue", ":", "COM", "VARIANT", "according", "to", "propertyId?", "todo", ".", "propertyId", ":", "int", "a", "value", "i...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3623-L3633
[ "def", "FindItemByProperty", "(", "control", ":", "'Control'", ",", "propertyId", ":", "int", ",", "propertyValue", ")", "->", "'Control'", ":", "ele", "=", "self", ".", "pattern", ".", "FindItemByProperty", "(", "control", ".", "Element", ",", "propertyId", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
LegacyIAccessiblePattern.GetSelection
Call IUIAutomationLegacyIAccessiblePattern::GetCurrentSelection. Return list, a list of `Control` subclasses, the Microsoft Active Accessibility property that identifies the selected children of this element. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-getcurrentselection
uiautomation/uiautomation.py
def GetSelection(self) -> list: """ Call IUIAutomationLegacyIAccessiblePattern::GetCurrentSelection. Return list, a list of `Control` subclasses, the Microsoft Active Accessibility property that identifies the selected children of this element. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-getcurrentselection """ eleArray = self.pattern.GetCurrentSelection() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetSelection(self) -> list: """ Call IUIAutomationLegacyIAccessiblePattern::GetCurrentSelection. Return list, a list of `Control` subclasses, the Microsoft Active Accessibility property that identifies the selected children of this element. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-getcurrentselection """ eleArray = self.pattern.GetCurrentSelection() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationLegacyIAccessiblePattern", "::", "GetCurrentSelection", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "the", "Microsoft", "Active", "Accessibility", "property", "that", "identifies", "the", "selected", "children", "of", "this",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3743-L3759
[ "def", "GetSelection", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentSelection", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Length", ")",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
LegacyIAccessiblePattern.SetValue
Call IUIAutomationLegacyIAccessiblePattern::SetValue. Set the Microsoft Active Accessibility value property for the element. value: str. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-setvalue
uiautomation/uiautomation.py
def SetValue(self, value: str, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationLegacyIAccessiblePattern::SetValue. Set the Microsoft Active Accessibility value property for the element. value: str. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-setvalue """ ret = self.pattern.SetValue(value) == S_OK time.sleep(waitTime) return ret
def SetValue(self, value: str, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationLegacyIAccessiblePattern::SetValue. Set the Microsoft Active Accessibility value property for the element. value: str. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-setvalue """ ret = self.pattern.SetValue(value) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationLegacyIAccessiblePattern", "::", "SetValue", ".", "Set", "the", "Microsoft", "Active", "Accessibility", "value", "property", "for", "the", "element", ".", "value", ":", "str", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "i...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3783-L3794
[ "def", "SetValue", "(", "self", ",", "value", ":", "str", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "SetValue", "(", "value", ")", "==", "S_OK", "time", ".", "sleep", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
MultipleViewPattern.SetView
Call IUIAutomationMultipleViewPattern::SetCurrentView. Set the view of the control. view: int, the control-specific view identifier. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-getviewname
uiautomation/uiautomation.py
def SetView(self, view: int) -> bool: """ Call IUIAutomationMultipleViewPattern::SetCurrentView. Set the view of the control. view: int, the control-specific view identifier. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-getviewname """ return self.pattern.SetCurrentView(view) == S_OK
def SetView(self, view: int) -> bool: """ Call IUIAutomationMultipleViewPattern::SetCurrentView. Set the view of the control. view: int, the control-specific view identifier. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-getviewname """ return self.pattern.SetCurrentView(view) == S_OK
[ "Call", "IUIAutomationMultipleViewPattern", "::", "SetCurrentView", ".", "Set", "the", "view", "of", "the", "control", ".", "view", ":", "int", "the", "control", "-", "specific", "view", "identifier", ".", "Return", "bool", "True", "if", "succeed", "otherwise", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L3829-L3837
[ "def", "SetView", "(", "self", ",", "view", ":", "int", ")", "->", "bool", ":", "return", "self", ".", "pattern", ".", "SetCurrentView", "(", "view", ")", "==", "S_OK" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
ScrollPattern.Scroll
Call IUIAutomationScrollPattern::Scroll. Scroll the visible region of the content area horizontally and vertically. horizontalAmount: int, a value in ScrollAmount. verticalAmount: int, a value in ScrollAmount. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-scroll
uiautomation/uiautomation.py
def Scroll(self, horizontalAmount: int, verticalAmount: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationScrollPattern::Scroll. Scroll the visible region of the content area horizontally and vertically. horizontalAmount: int, a value in ScrollAmount. verticalAmount: int, a value in ScrollAmount. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-scroll """ ret = self.pattern.Scroll(horizontalAmount, verticalAmount) == S_OK time.sleep(waitTime) return ret
def Scroll(self, horizontalAmount: int, verticalAmount: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationScrollPattern::Scroll. Scroll the visible region of the content area horizontally and vertically. horizontalAmount: int, a value in ScrollAmount. verticalAmount: int, a value in ScrollAmount. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-scroll """ ret = self.pattern.Scroll(horizontalAmount, verticalAmount) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationScrollPattern", "::", "Scroll", ".", "Scroll", "the", "visible", "region", "of", "the", "content", "area", "horizontally", "and", "vertically", ".", "horizontalAmount", ":", "int", "a", "value", "in", "ScrollAmount", ".", "verticalAmount", ":...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4018-L4030
[ "def", "Scroll", "(", "self", ",", "horizontalAmount", ":", "int", ",", "verticalAmount", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Scroll", "(", "horizontalAmou...
2cc91060982cc8b777152e698d677cc2989bf263
valid
ScrollPattern.SetScrollPercent
Call IUIAutomationScrollPattern::SetScrollPercent. Set the horizontal and vertical scroll positions as a percentage of the total content area within the UI Automation element. horizontalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll. verticalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-setscrollpercent
uiautomation/uiautomation.py
def SetScrollPercent(self, horizontalPercent: float, verticalPercent: float, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationScrollPattern::SetScrollPercent. Set the horizontal and vertical scroll positions as a percentage of the total content area within the UI Automation element. horizontalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll. verticalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-setscrollpercent """ ret = self.pattern.SetScrollPercent(horizontalPercent, verticalPercent) == S_OK time.sleep(waitTime) return ret
def SetScrollPercent(self, horizontalPercent: float, verticalPercent: float, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationScrollPattern::SetScrollPercent. Set the horizontal and vertical scroll positions as a percentage of the total content area within the UI Automation element. horizontalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll. verticalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-setscrollpercent """ ret = self.pattern.SetScrollPercent(horizontalPercent, verticalPercent) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationScrollPattern", "::", "SetScrollPercent", ".", "Set", "the", "horizontal", "and", "vertical", "scroll", "positions", "as", "a", "percentage", "of", "the", "total", "content", "area", "within", "the", "UI", "Automation", "element", ".", "horiz...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4032-L4044
[ "def", "SetScrollPercent", "(", "self", ",", "horizontalPercent", ":", "float", ",", "verticalPercent", ":", "float", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "SetScrollPercent"...
2cc91060982cc8b777152e698d677cc2989bf263
valid
SpreadsheetItemPattern.GetAnnotationObjects
Call IUIAutomationSelectionPattern::GetCurrentAnnotationObjects. Return list, a list of `Control` subclasses representing the annotations associated with this spreadsheet cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationspreadsheetitempattern-getcurrentannotationobjects
uiautomation/uiautomation.py
def GetAnnotationObjects(self) -> list: """ Call IUIAutomationSelectionPattern::GetCurrentAnnotationObjects. Return list, a list of `Control` subclasses representing the annotations associated with this spreadsheet cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationspreadsheetitempattern-getcurrentannotationobjects """ eleArray = self.pattern.GetCurrentAnnotationObjects() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetAnnotationObjects(self) -> list: """ Call IUIAutomationSelectionPattern::GetCurrentAnnotationObjects. Return list, a list of `Control` subclasses representing the annotations associated with this spreadsheet cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationspreadsheetitempattern-getcurrentannotationobjects """ eleArray = self.pattern.GetCurrentAnnotationObjects() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationSelectionPattern", "::", "GetCurrentAnnotationObjects", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "representing", "the", "annotations", "associated", "with", "this", "spreadsheet", "cell", ".", "Refer", "https", ":", "//"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4168-L4183
[ "def", "GetAnnotationObjects", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentAnnotationObjects", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
SpreadsheetPattern.GetItemByName
Call IUIAutomationSpreadsheetPattern::GetItemByName. name: str. Return `Control` subclass or None, represents the spreadsheet cell that has the specified name.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationspreadsheetpattern-getitembyname
uiautomation/uiautomation.py
def GetItemByName(self, name: str) -> 'Control': """ Call IUIAutomationSpreadsheetPattern::GetItemByName. name: str. Return `Control` subclass or None, represents the spreadsheet cell that has the specified name.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationspreadsheetpattern-getitembyname """ ele = self.pattern.GetItemByName(name) return Control.CreateControlFromElement(element=ele)
def GetItemByName(self, name: str) -> 'Control': """ Call IUIAutomationSpreadsheetPattern::GetItemByName. name: str. Return `Control` subclass or None, represents the spreadsheet cell that has the specified name.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationspreadsheetpattern-getitembyname """ ele = self.pattern.GetItemByName(name) return Control.CreateControlFromElement(element=ele)
[ "Call", "IUIAutomationSpreadsheetPattern", "::", "GetItemByName", ".", "name", ":", "str", ".", "Return", "Control", "subclass", "or", "None", "represents", "the", "spreadsheet", "cell", "that", "has", "the", "specified", "name", "..", "Refer", "https", ":", "//...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4200-L4208
[ "def", "GetItemByName", "(", "self", ",", "name", ":", "str", ")", "->", "'Control'", ":", "ele", "=", "self", ".", "pattern", ".", "GetItemByName", "(", "name", ")", "return", "Control", ".", "CreateControlFromElement", "(", "element", "=", "ele", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
TableItemPattern.GetColumnHeaderItems
Call IUIAutomationTableItemPattern::GetCurrentColumnHeaderItems. Return list, a list of `Control` subclasses, the column headers associated with a table item or cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtableitempattern-getcurrentcolumnheaderitems
uiautomation/uiautomation.py
def GetColumnHeaderItems(self) -> list: """ Call IUIAutomationTableItemPattern::GetCurrentColumnHeaderItems. Return list, a list of `Control` subclasses, the column headers associated with a table item or cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtableitempattern-getcurrentcolumnheaderitems """ eleArray = self.pattern.GetCurrentColumnHeaderItems() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetColumnHeaderItems(self) -> list: """ Call IUIAutomationTableItemPattern::GetCurrentColumnHeaderItems. Return list, a list of `Control` subclasses, the column headers associated with a table item or cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtableitempattern-getcurrentcolumnheaderitems """ eleArray = self.pattern.GetCurrentColumnHeaderItems() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationTableItemPattern", "::", "GetCurrentColumnHeaderItems", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "the", "column", "headers", "associated", "with", "a", "table", "item", "or", "cell", ".", "Refer", "https", ":", "//",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4306-L4321
[ "def", "GetColumnHeaderItems", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentColumnHeaderItems", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TableItemPattern.GetRowHeaderItems
Call IUIAutomationTableItemPattern::GetCurrentRowHeaderItems. Return list, a list of `Control` subclasses, the row headers associated with a table item or cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtableitempattern-getcurrentrowheaderitems
uiautomation/uiautomation.py
def GetRowHeaderItems(self) -> list: """ Call IUIAutomationTableItemPattern::GetCurrentRowHeaderItems. Return list, a list of `Control` subclasses, the row headers associated with a table item or cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtableitempattern-getcurrentrowheaderitems """ eleArray = self.pattern.GetCurrentRowHeaderItems() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetRowHeaderItems(self) -> list: """ Call IUIAutomationTableItemPattern::GetCurrentRowHeaderItems. Return list, a list of `Control` subclasses, the row headers associated with a table item or cell. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtableitempattern-getcurrentrowheaderitems """ eleArray = self.pattern.GetCurrentRowHeaderItems() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationTableItemPattern", "::", "GetCurrentRowHeaderItems", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "the", "row", "headers", "associated", "with", "a", "table", "item", "or", "cell", ".", "Refer", "https", ":", "//", "do...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4323-L4338
[ "def", "GetRowHeaderItems", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentRowHeaderItems", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Lengt...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TablePattern.GetColumnHeaders
Call IUIAutomationTablePattern::GetCurrentColumnHeaders. Return list, a list of `Control` subclasses, representing all the column headers in a table.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtablepattern-getcurrentcolumnheaders
uiautomation/uiautomation.py
def GetColumnHeaders(self) -> list: """ Call IUIAutomationTablePattern::GetCurrentColumnHeaders. Return list, a list of `Control` subclasses, representing all the column headers in a table.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtablepattern-getcurrentcolumnheaders """ eleArray = self.pattern.GetCurrentColumnHeaders() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetColumnHeaders(self) -> list: """ Call IUIAutomationTablePattern::GetCurrentColumnHeaders. Return list, a list of `Control` subclasses, representing all the column headers in a table.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtablepattern-getcurrentcolumnheaders """ eleArray = self.pattern.GetCurrentColumnHeaders() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationTablePattern", "::", "GetCurrentColumnHeaders", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "representing", "all", "the", "column", "headers", "in", "a", "table", "..", "Refer", "https", ":", "//", "docs", ".", "micro...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4356-L4371
[ "def", "GetColumnHeaders", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentColumnHeaders", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Length"...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TablePattern.GetRowHeaders
Call IUIAutomationTablePattern::GetCurrentRowHeaders. Return list, a list of `Control` subclasses, representing all the row headers in a table. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtablepattern-getcurrentrowheaders
uiautomation/uiautomation.py
def GetRowHeaders(self) -> list: """ Call IUIAutomationTablePattern::GetCurrentRowHeaders. Return list, a list of `Control` subclasses, representing all the row headers in a table. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtablepattern-getcurrentrowheaders """ eleArray = self.pattern.GetCurrentRowHeaders() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetRowHeaders(self) -> list: """ Call IUIAutomationTablePattern::GetCurrentRowHeaders. Return list, a list of `Control` subclasses, representing all the row headers in a table. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtablepattern-getcurrentrowheaders """ eleArray = self.pattern.GetCurrentRowHeaders() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationTablePattern", "::", "GetCurrentRowHeaders", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "representing", "all", "the", "row", "headers", "in", "a", "table", ".", "Refer", "https", ":", "//", "docs", ".", "microsoft", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4373-L4388
[ "def", "GetRowHeaders", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetCurrentRowHeaders", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Length", ")...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.Compare
Call IUIAutomationTextRange::Compare. textRange: `TextRange`. Return bool, specifies whether this text range has the same endpoints as another text range. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compare
uiautomation/uiautomation.py
def Compare(self, textRange: 'TextRange') -> bool: """ Call IUIAutomationTextRange::Compare. textRange: `TextRange`. Return bool, specifies whether this text range has the same endpoints as another text range. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compare """ return bool(self.textRange.Compare(textRange.textRange))
def Compare(self, textRange: 'TextRange') -> bool: """ Call IUIAutomationTextRange::Compare. textRange: `TextRange`. Return bool, specifies whether this text range has the same endpoints as another text range. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compare """ return bool(self.textRange.Compare(textRange.textRange))
[ "Call", "IUIAutomationTextRange", "::", "Compare", ".", "textRange", ":", "TextRange", ".", "Return", "bool", "specifies", "whether", "this", "text", "range", "has", "the", "same", "endpoints", "as", "another", "text", "range", ".", "Refer", "https", ":", "//"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4418-L4425
[ "def", "Compare", "(", "self", ",", "textRange", ":", "'TextRange'", ")", "->", "bool", ":", "return", "bool", "(", "self", ".", "textRange", ".", "Compare", "(", "textRange", ".", "textRange", ")", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.CompareEndpoints
Call IUIAutomationTextRange::CompareEndpoints. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEndpoint`. Return int, a negative value if the caller's endpoint occurs earlier in the text than the target endpoint; 0 if the caller's endpoint is at the same location as the target endpoint; or a positive value if the caller's endpoint occurs later in the text than the target endpoint. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compareendpoints
uiautomation/uiautomation.py
def CompareEndpoints(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int) -> int: """ Call IUIAutomationTextRange::CompareEndpoints. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEndpoint`. Return int, a negative value if the caller's endpoint occurs earlier in the text than the target endpoint; 0 if the caller's endpoint is at the same location as the target endpoint; or a positive value if the caller's endpoint occurs later in the text than the target endpoint. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compareendpoints """ return self.textRange.CompareEndpoints(srcEndPoint, textRange, targetEndPoint)
def CompareEndpoints(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int) -> int: """ Call IUIAutomationTextRange::CompareEndpoints. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEndpoint`. Return int, a negative value if the caller's endpoint occurs earlier in the text than the target endpoint; 0 if the caller's endpoint is at the same location as the target endpoint; or a positive value if the caller's endpoint occurs later in the text than the target endpoint. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compareendpoints """ return self.textRange.CompareEndpoints(srcEndPoint, textRange, targetEndPoint)
[ "Call", "IUIAutomationTextRange", "::", "CompareEndpoints", ".", "srcEndPoint", ":", "int", "a", "value", "in", "class", "TextPatternRangeEndpoint", ".", "textRange", ":", "TextRange", ".", "targetEndPoint", ":", "int", "a", "value", "in", "class", "TextPatternRange...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4427-L4438
[ "def", "CompareEndpoints", "(", "self", ",", "srcEndPoint", ":", "int", ",", "textRange", ":", "'TextRange'", ",", "targetEndPoint", ":", "int", ")", "->", "int", ":", "return", "self", ".", "textRange", ".", "CompareEndpoints", "(", "srcEndPoint", ",", "tex...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.FindAttribute
Call IUIAutomationTextRange::FindAttribute. textAttributeID: int, a value in class `TextAttributeId`. val: COM VARIANT according to textAttributeId? todo. backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False. return `TextRange` or None, a text range subset that has the specified text attribute value. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findattribute
uiautomation/uiautomation.py
def FindAttribute(self, textAttributeId: int, val, backward: bool) -> 'TextRange': """ Call IUIAutomationTextRange::FindAttribute. textAttributeID: int, a value in class `TextAttributeId`. val: COM VARIANT according to textAttributeId? todo. backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False. return `TextRange` or None, a text range subset that has the specified text attribute value. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findattribute """ textRange = self.textRange.FindAttribute(textAttributeId, val, int(backward)) if textRange: return TextRange(textRange=textRange)
def FindAttribute(self, textAttributeId: int, val, backward: bool) -> 'TextRange': """ Call IUIAutomationTextRange::FindAttribute. textAttributeID: int, a value in class `TextAttributeId`. val: COM VARIANT according to textAttributeId? todo. backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False. return `TextRange` or None, a text range subset that has the specified text attribute value. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findattribute """ textRange = self.textRange.FindAttribute(textAttributeId, val, int(backward)) if textRange: return TextRange(textRange=textRange)
[ "Call", "IUIAutomationTextRange", "::", "FindAttribute", ".", "textAttributeID", ":", "int", "a", "value", "in", "class", "TextAttributeId", ".", "val", ":", "COM", "VARIANT", "according", "to", "textAttributeId?", "todo", ".", "backward", ":", "bool", "True", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4454-L4465
[ "def", "FindAttribute", "(", "self", ",", "textAttributeId", ":", "int", ",", "val", ",", "backward", ":", "bool", ")", "->", "'TextRange'", ":", "textRange", "=", "self", ".", "textRange", ".", "FindAttribute", "(", "textAttributeId", ",", "val", ",", "in...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.FindText
Call IUIAutomationTextRange::FindText. text: str, backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False. ignoreCase: bool, True if case should be ignored; otherwise False. return `TextRange` or None, a text range subset that contains the specified text. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findtext
uiautomation/uiautomation.py
def FindText(self, text: str, backward: bool, ignoreCase: bool) -> 'TextRange': """ Call IUIAutomationTextRange::FindText. text: str, backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False. ignoreCase: bool, True if case should be ignored; otherwise False. return `TextRange` or None, a text range subset that contains the specified text. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findtext """ textRange = self.textRange.FindText(text, int(backward), int(ignoreCase)) if textRange: return TextRange(textRange=textRange)
def FindText(self, text: str, backward: bool, ignoreCase: bool) -> 'TextRange': """ Call IUIAutomationTextRange::FindText. text: str, backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False. ignoreCase: bool, True if case should be ignored; otherwise False. return `TextRange` or None, a text range subset that contains the specified text. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findtext """ textRange = self.textRange.FindText(text, int(backward), int(ignoreCase)) if textRange: return TextRange(textRange=textRange)
[ "Call", "IUIAutomationTextRange", "::", "FindText", ".", "text", ":", "str", "backward", ":", "bool", "True", "if", "the", "last", "occurring", "text", "range", "should", "be", "returned", "instead", "of", "the", "first", ";", "otherwise", "False", ".", "ign...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4467-L4478
[ "def", "FindText", "(", "self", ",", "text", ":", "str", ",", "backward", ":", "bool", ",", "ignoreCase", ":", "bool", ")", "->", "'TextRange'", ":", "textRange", "=", "self", ".", "textRange", ".", "FindText", "(", "text", ",", "int", "(", "backward",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.GetAttributeValue
Call IUIAutomationTextRange::GetAttributeValue. textAttributeId: int, a value in class `TextAttributeId`. Return `ctypes.POINTER(comtypes.IUnknown)` or None, the value of the specified text attribute across the entire text range, todo. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getattributevalue
uiautomation/uiautomation.py
def GetAttributeValue(self, textAttributeId: int) -> ctypes.POINTER(comtypes.IUnknown): """ Call IUIAutomationTextRange::GetAttributeValue. textAttributeId: int, a value in class `TextAttributeId`. Return `ctypes.POINTER(comtypes.IUnknown)` or None, the value of the specified text attribute across the entire text range, todo. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getattributevalue """ return self.textRange.GetAttributeValue(textAttributeId)
def GetAttributeValue(self, textAttributeId: int) -> ctypes.POINTER(comtypes.IUnknown): """ Call IUIAutomationTextRange::GetAttributeValue. textAttributeId: int, a value in class `TextAttributeId`. Return `ctypes.POINTER(comtypes.IUnknown)` or None, the value of the specified text attribute across the entire text range, todo. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getattributevalue """ return self.textRange.GetAttributeValue(textAttributeId)
[ "Call", "IUIAutomationTextRange", "::", "GetAttributeValue", ".", "textAttributeId", ":", "int", "a", "value", "in", "class", "TextAttributeId", ".", "Return", "ctypes", ".", "POINTER", "(", "comtypes", ".", "IUnknown", ")", "or", "None", "the", "value", "of", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4480-L4487
[ "def", "GetAttributeValue", "(", "self", ",", "textAttributeId", ":", "int", ")", "->", "ctypes", ".", "POINTER", "(", "comtypes", ".", "IUnknown", ")", ":", "return", "self", ".", "textRange", ".", "GetAttributeValue", "(", "textAttributeId", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.GetBoundingRectangles
Call IUIAutomationTextRange::GetBoundingRectangles. textAttributeId: int, a value in class `TextAttributeId`. Return list, a list of `Rect`. bounding rectangles for each fully or partially visible line of text in a text range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getboundingrectangles for rect in textRange.GetBoundingRectangles(): print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter())
uiautomation/uiautomation.py
def GetBoundingRectangles(self) -> list: """ Call IUIAutomationTextRange::GetBoundingRectangles. textAttributeId: int, a value in class `TextAttributeId`. Return list, a list of `Rect`. bounding rectangles for each fully or partially visible line of text in a text range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getboundingrectangles for rect in textRange.GetBoundingRectangles(): print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter()) """ floats = self.textRange.GetBoundingRectangles() rects = [] for i in range(len(floats) // 4): rect = Rect(int(floats[i * 4]), int(floats[i * 4 + 1]), int(floats[i * 4]) + int(floats[i * 4 + 2]), int(floats[i * 4 + 1]) + int(floats[i * 4 + 3])) rects.append(rect) return rects
def GetBoundingRectangles(self) -> list: """ Call IUIAutomationTextRange::GetBoundingRectangles. textAttributeId: int, a value in class `TextAttributeId`. Return list, a list of `Rect`. bounding rectangles for each fully or partially visible line of text in a text range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getboundingrectangles for rect in textRange.GetBoundingRectangles(): print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter()) """ floats = self.textRange.GetBoundingRectangles() rects = [] for i in range(len(floats) // 4): rect = Rect(int(floats[i * 4]), int(floats[i * 4 + 1]), int(floats[i * 4]) + int(floats[i * 4 + 2]), int(floats[i * 4 + 1]) + int(floats[i * 4 + 3])) rects.append(rect) return rects
[ "Call", "IUIAutomationTextRange", "::", "GetBoundingRectangles", ".", "textAttributeId", ":", "int", "a", "value", "in", "class", "TextAttributeId", ".", "Return", "list", "a", "list", "of", "Rect", ".", "bounding", "rectangles", "for", "each", "fully", "or", "p...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4489-L4506
[ "def", "GetBoundingRectangles", "(", "self", ")", "->", "list", ":", "floats", "=", "self", ".", "textRange", ".", "GetBoundingRectangles", "(", ")", "rects", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "floats", ")", "//", "4", ")", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.GetChildren
Call IUIAutomationTextRange::GetChildren. textAttributeId: int, a value in class `TextAttributeId`. Return list, a list of `Control` subclasses, embedded objects that fall within the text range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getchildren
uiautomation/uiautomation.py
def GetChildren(self) -> list: """ Call IUIAutomationTextRange::GetChildren. textAttributeId: int, a value in class `TextAttributeId`. Return list, a list of `Control` subclasses, embedded objects that fall within the text range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getchildren """ eleArray = self.textRange.GetChildren() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
def GetChildren(self) -> list: """ Call IUIAutomationTextRange::GetChildren. textAttributeId: int, a value in class `TextAttributeId`. Return list, a list of `Control` subclasses, embedded objects that fall within the text range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getchildren """ eleArray = self.textRange.GetChildren() if eleArray: controls = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) con = Control.CreateControlFromElement(element=ele) if con: controls.append(con) return controls return []
[ "Call", "IUIAutomationTextRange", "::", "GetChildren", ".", "textAttributeId", ":", "int", "a", "value", "in", "class", "TextAttributeId", ".", "Return", "list", "a", "list", "of", "Control", "subclasses", "embedded", "objects", "that", "fall", "within", "the", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4508-L4524
[ "def", "GetChildren", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "textRange", ".", "GetChildren", "(", ")", "if", "eleArray", ":", "controls", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Length", ")", ":",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.Move
Call IUIAutomationTextRange::Move. Move the text range forward or backward by the specified number of text units. unit: int, a value in class `TextUnit`. count: int, the number of text units to move. A positive value moves the text range forward. A negative value moves the text range backward. Zero has no effect. waitTime: float. Return: int, the number of text units actually moved. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-move
uiautomation/uiautomation.py
def Move(self, unit: int, count: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationTextRange::Move. Move the text range forward or backward by the specified number of text units. unit: int, a value in class `TextUnit`. count: int, the number of text units to move. A positive value moves the text range forward. A negative value moves the text range backward. Zero has no effect. waitTime: float. Return: int, the number of text units actually moved. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-move """ ret = self.textRange.Move(unit, count) time.sleep(waitTime) return ret
def Move(self, unit: int, count: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationTextRange::Move. Move the text range forward or backward by the specified number of text units. unit: int, a value in class `TextUnit`. count: int, the number of text units to move. A positive value moves the text range forward. A negative value moves the text range backward. Zero has no effect. waitTime: float. Return: int, the number of text units actually moved. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-move """ ret = self.textRange.Move(unit, count) time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTextRange", "::", "Move", ".", "Move", "the", "text", "range", "forward", "or", "backward", "by", "the", "specified", "number", "of", "text", "units", ".", "unit", ":", "int", "a", "value", "in", "class", "TextUnit", ".", "count", ":"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4543-L4557
[ "def", "Move", "(", "self", ",", "unit", ":", "int", ",", "count", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "int", ":", "ret", "=", "self", ".", "textRange", ".", "Move", "(", "unit", ",", "count", ")", "tim...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.MoveEndpointByRange
Call IUIAutomationTextRange::MoveEndpointByRange. Move one endpoint of the current text range to the specified endpoint of a second text range. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEndpoint`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyrange
uiautomation/uiautomation.py
def MoveEndpointByRange(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTextRange::MoveEndpointByRange. Move one endpoint of the current text range to the specified endpoint of a second text range. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEndpoint`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyrange """ ret = self.textRange.MoveEndpointByRange(srcEndPoint, textRange.textRange, targetEndPoint) == S_OK time.sleep(waitTime) return ret
def MoveEndpointByRange(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTextRange::MoveEndpointByRange. Move one endpoint of the current text range to the specified endpoint of a second text range. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEndpoint`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyrange """ ret = self.textRange.MoveEndpointByRange(srcEndPoint, textRange.textRange, targetEndPoint) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTextRange", "::", "MoveEndpointByRange", ".", "Move", "one", "endpoint", "of", "the", "current", "text", "range", "to", "the", "specified", "endpoint", "of", "a", "second", "text", "range", ".", "srcEndPoint", ":", "int", "a", "value", "i...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4559-L4572
[ "def", "MoveEndpointByRange", "(", "self", ",", "srcEndPoint", ":", "int", ",", "textRange", ":", "'TextRange'", ",", "targetEndPoint", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.MoveEndpointByUnit
Call IUIAutomationTextRange::MoveEndpointByUnit. Move one endpoint of the text range the specified number of text units within the document range. endPoint: int, a value in class `TextPatternRangeEndpoint`. unit: int, a value in class `TextUnit`. count: int, the number of units to move. A positive count moves the endpoint forward. A negative count moves backward. A count of 0 has no effect. waitTime: float. Return int, the count of units actually moved. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyunit
uiautomation/uiautomation.py
def MoveEndpointByUnit(self, endPoint: int, unit: int, count: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationTextRange::MoveEndpointByUnit. Move one endpoint of the text range the specified number of text units within the document range. endPoint: int, a value in class `TextPatternRangeEndpoint`. unit: int, a value in class `TextUnit`. count: int, the number of units to move. A positive count moves the endpoint forward. A negative count moves backward. A count of 0 has no effect. waitTime: float. Return int, the count of units actually moved. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyunit """ ret = self.textRange.MoveEndpointByUnit(endPoint, unit, count) time.sleep(waitTime) return ret
def MoveEndpointByUnit(self, endPoint: int, unit: int, count: int, waitTime: float = OPERATION_WAIT_TIME) -> int: """ Call IUIAutomationTextRange::MoveEndpointByUnit. Move one endpoint of the text range the specified number of text units within the document range. endPoint: int, a value in class `TextPatternRangeEndpoint`. unit: int, a value in class `TextUnit`. count: int, the number of units to move. A positive count moves the endpoint forward. A negative count moves backward. A count of 0 has no effect. waitTime: float. Return int, the count of units actually moved. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyunit """ ret = self.textRange.MoveEndpointByUnit(endPoint, unit, count) time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTextRange", "::", "MoveEndpointByUnit", ".", "Move", "one", "endpoint", "of", "the", "text", "range", "the", "specified", "number", "of", "text", "units", "within", "the", "document", "range", ".", "endPoint", ":", "int", "a", "value", "i...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4574-L4590
[ "def", "MoveEndpointByUnit", "(", "self", ",", "endPoint", ":", "int", ",", "unit", ":", "int", ",", "count", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "int", ":", "ret", "=", "self", ".", "textRange", ".", "Move...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextRange.ScrollIntoView
Call IUIAutomationTextRange::ScrollIntoView. Cause the text control to scroll until the text range is visible in the viewport. alignTop: bool, True if the text control should be scrolled so that the text range is flush with the top of the viewport; False if it should be flush with the bottom of the viewport. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-scrollintoview
uiautomation/uiautomation.py
def ScrollIntoView(self, alignTop: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTextRange::ScrollIntoView. Cause the text control to scroll until the text range is visible in the viewport. alignTop: bool, True if the text control should be scrolled so that the text range is flush with the top of the viewport; False if it should be flush with the bottom of the viewport. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-scrollintoview """ ret = self.textRange.ScrollIntoView(int(alignTop)) == S_OK time.sleep(waitTime) return ret
def ScrollIntoView(self, alignTop: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTextRange::ScrollIntoView. Cause the text control to scroll until the text range is visible in the viewport. alignTop: bool, True if the text control should be scrolled so that the text range is flush with the top of the viewport; False if it should be flush with the bottom of the viewport. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-scrollintoview """ ret = self.textRange.ScrollIntoView(int(alignTop)) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTextRange", "::", "ScrollIntoView", ".", "Cause", "the", "text", "control", "to", "scroll", "until", "the", "text", "range", "is", "visible", "in", "the", "viewport", ".", "alignTop", ":", "bool", "True", "if", "the", "text", "control", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4604-L4616
[ "def", "ScrollIntoView", "(", "self", ",", "alignTop", ":", "bool", "=", "True", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "textRange", ".", "ScrollIntoView", "(", "int", "(", "alignTop", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextEditPattern.GetActiveComposition
Call IUIAutomationTextEditPattern::GetActiveComposition. Return `TextRange` or None, the active composition. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtexteditpattern-getactivecomposition
uiautomation/uiautomation.py
def GetActiveComposition(self) -> TextRange: """ Call IUIAutomationTextEditPattern::GetActiveComposition. Return `TextRange` or None, the active composition. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtexteditpattern-getactivecomposition """ textRange = self.pattern.GetActiveComposition() if textRange: return TextRange(textRange=textRange)
def GetActiveComposition(self) -> TextRange: """ Call IUIAutomationTextEditPattern::GetActiveComposition. Return `TextRange` or None, the active composition. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtexteditpattern-getactivecomposition """ textRange = self.pattern.GetActiveComposition() if textRange: return TextRange(textRange=textRange)
[ "Call", "IUIAutomationTextEditPattern", "::", "GetActiveComposition", ".", "Return", "TextRange", "or", "None", "the", "active", "composition", ".", "Refer", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "windows", "/", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4662-L4670
[ "def", "GetActiveComposition", "(", "self", ")", "->", "TextRange", ":", "textRange", "=", "self", ".", "pattern", ".", "GetActiveComposition", "(", ")", "if", "textRange", ":", "return", "TextRange", "(", "textRange", "=", "textRange", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextEditPattern.GetConversionTarget
Call IUIAutomationTextEditPattern::GetConversionTarget. Return `TextRange` or None, the current conversion target range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtexteditpattern-getconversiontarget
uiautomation/uiautomation.py
def GetConversionTarget(self) -> TextRange: """ Call IUIAutomationTextEditPattern::GetConversionTarget. Return `TextRange` or None, the current conversion target range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtexteditpattern-getconversiontarget """ textRange = self.pattern.GetConversionTarget() if textRange: return TextRange(textRange=textRange)
def GetConversionTarget(self) -> TextRange: """ Call IUIAutomationTextEditPattern::GetConversionTarget. Return `TextRange` or None, the current conversion target range.. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtexteditpattern-getconversiontarget """ textRange = self.pattern.GetConversionTarget() if textRange: return TextRange(textRange=textRange)
[ "Call", "IUIAutomationTextEditPattern", "::", "GetConversionTarget", ".", "Return", "TextRange", "or", "None", "the", "current", "conversion", "target", "range", "..", "Refer", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4672-L4680
[ "def", "GetConversionTarget", "(", "self", ")", "->", "TextRange", ":", "textRange", "=", "self", ".", "pattern", ".", "GetConversionTarget", "(", ")", "if", "textRange", ":", "return", "TextRange", "(", "textRange", "=", "textRange", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextPattern.GetVisibleRanges
Call IUIAutomationTextPattern::GetVisibleRanges. Return list, a list of `TextRange`, disjoint text ranges from a text-based control where each text range represents a contiguous span of visible text. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-getvisibleranges
uiautomation/uiautomation.py
def GetVisibleRanges(self) -> list: """ Call IUIAutomationTextPattern::GetVisibleRanges. Return list, a list of `TextRange`, disjoint text ranges from a text-based control where each text range represents a contiguous span of visible text. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-getvisibleranges """ eleArray = self.pattern.GetVisibleRanges() if eleArray: textRanges = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) textRanges.append(TextRange(textRange=ele)) return textRanges return []
def GetVisibleRanges(self) -> list: """ Call IUIAutomationTextPattern::GetVisibleRanges. Return list, a list of `TextRange`, disjoint text ranges from a text-based control where each text range represents a contiguous span of visible text. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-getvisibleranges """ eleArray = self.pattern.GetVisibleRanges() if eleArray: textRanges = [] for i in range(eleArray.Length): ele = eleArray.GetElement(i) textRanges.append(TextRange(textRange=ele)) return textRanges return []
[ "Call", "IUIAutomationTextPattern", "::", "GetVisibleRanges", ".", "Return", "list", "a", "list", "of", "TextRange", "disjoint", "text", "ranges", "from", "a", "text", "-", "based", "control", "where", "each", "text", "range", "represents", "a", "contiguous", "s...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4723-L4737
[ "def", "GetVisibleRanges", "(", "self", ")", "->", "list", ":", "eleArray", "=", "self", ".", "pattern", ".", "GetVisibleRanges", "(", ")", "if", "eleArray", ":", "textRanges", "=", "[", "]", "for", "i", "in", "range", "(", "eleArray", ".", "Length", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextPattern.RangeFromChild
Call IUIAutomationTextPattern::RangeFromChild. child: `Control` or its subclass. Return `TextRange` or None, a text range enclosing a child element such as an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefromchild
uiautomation/uiautomation.py
def RangeFromChild(self, child) -> TextRange: """ Call IUIAutomationTextPattern::RangeFromChild. child: `Control` or its subclass. Return `TextRange` or None, a text range enclosing a child element such as an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefromchild """ textRange = self.pattern.RangeFromChild(Control.Element) if textRange: return TextRange(textRange=textRange)
def RangeFromChild(self, child) -> TextRange: """ Call IUIAutomationTextPattern::RangeFromChild. child: `Control` or its subclass. Return `TextRange` or None, a text range enclosing a child element such as an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefromchild """ textRange = self.pattern.RangeFromChild(Control.Element) if textRange: return TextRange(textRange=textRange)
[ "Call", "IUIAutomationTextPattern", "::", "RangeFromChild", ".", "child", ":", "Control", "or", "its", "subclass", ".", "Return", "TextRange", "or", "None", "a", "text", "range", "enclosing", "a", "child", "element", "such", "as", "an", "image", "hyperlink", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4739-L4749
[ "def", "RangeFromChild", "(", "self", ",", "child", ")", "->", "TextRange", ":", "textRange", "=", "self", ".", "pattern", ".", "RangeFromChild", "(", "Control", ".", "Element", ")", "if", "textRange", ":", "return", "TextRange", "(", "textRange", "=", "te...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TextPattern.RangeFromPoint
Call IUIAutomationTextPattern::RangeFromPoint. child: `Control` or its subclass. Return `TextRange` or None, the degenerate (empty) text range nearest to the specified screen coordinates. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefrompoint
uiautomation/uiautomation.py
def RangeFromPoint(self, x: int, y: int) -> TextRange: """ Call IUIAutomationTextPattern::RangeFromPoint. child: `Control` or its subclass. Return `TextRange` or None, the degenerate (empty) text range nearest to the specified screen coordinates. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefrompoint """ textRange = self.pattern.RangeFromPoint(ctypes.wintypes.POINT(x, y)) if textRange: return TextRange(textRange=textRange)
def RangeFromPoint(self, x: int, y: int) -> TextRange: """ Call IUIAutomationTextPattern::RangeFromPoint. child: `Control` or its subclass. Return `TextRange` or None, the degenerate (empty) text range nearest to the specified screen coordinates. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefrompoint """ textRange = self.pattern.RangeFromPoint(ctypes.wintypes.POINT(x, y)) if textRange: return TextRange(textRange=textRange)
[ "Call", "IUIAutomationTextPattern", "::", "RangeFromPoint", ".", "child", ":", "Control", "or", "its", "subclass", ".", "Return", "TextRange", "or", "None", "the", "degenerate", "(", "empty", ")", "text", "range", "nearest", "to", "the", "specified", "screen", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4751-L4760
[ "def", "RangeFromPoint", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "TextRange", ":", "textRange", "=", "self", ".", "pattern", ".", "RangeFromPoint", "(", "ctypes", ".", "wintypes", ".", "POINT", "(", "x", ",", "y", ")", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TransformPattern.Move
Call IUIAutomationTransformPattern::Move. Move the UI Automation element. x: int. y: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-move
uiautomation/uiautomation.py
def Move(self, x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern::Move. Move the UI Automation element. x: int. y: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-move """ ret = self.pattern.Move(x, y) == S_OK time.sleep(waitTime) return ret
def Move(self, x: int, y: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern::Move. Move the UI Automation element. x: int. y: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-move """ ret = self.pattern.Move(x, y) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTransformPattern", "::", "Move", ".", "Move", "the", "UI", "Automation", "element", ".", "x", ":", "int", ".", "y", ":", "int", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", ".", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4832-L4844
[ "def", "Move", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Move", "(", "x", ",", "y", ")", "==", "S_OK", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TransformPattern.Resize
Call IUIAutomationTransformPattern::Resize. Resize the UI Automation element. width: int. height: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-resize
uiautomation/uiautomation.py
def Resize(self, width: int, height: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern::Resize. Resize the UI Automation element. width: int. height: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-resize """ ret = self.pattern.Resize(width, height) == S_OK time.sleep(waitTime) return ret
def Resize(self, width: int, height: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern::Resize. Resize the UI Automation element. width: int. height: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-resize """ ret = self.pattern.Resize(width, height) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTransformPattern", "::", "Resize", ".", "Resize", "the", "UI", "Automation", "element", ".", "width", ":", "int", ".", "height", ":", "int", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "Fa...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4846-L4858
[ "def", "Resize", "(", "self", ",", "width", ":", "int", ",", "height", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Resize", "(", "width", ",", "height", ")",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TransformPattern.Rotate
Call IUIAutomationTransformPattern::Rotate. Rotates the UI Automation element. degrees: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-rotate
uiautomation/uiautomation.py
def Rotate(self, degrees: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern::Rotate. Rotates the UI Automation element. degrees: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-rotate """ ret = self.pattern.Rotate(degrees) == S_OK time.sleep(waitTime) return ret
def Rotate(self, degrees: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern::Rotate. Rotates the UI Automation element. degrees: int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-rotate """ ret = self.pattern.Rotate(degrees) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTransformPattern", "::", "Rotate", ".", "Rotates", "the", "UI", "Automation", "element", ".", "degrees", ":", "int", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", ".", "Refer", "https...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4860-L4871
[ "def", "Rotate", "(", "self", ",", "degrees", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Rotate", "(", "degrees", ")", "==", "S_OK", "time", ".", "sleep", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TransformPattern2.Zoom
Call IUIAutomationTransformPattern2::Zoom. Zoom the viewport of the control. zoomLevel: float for int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoom
uiautomation/uiautomation.py
def Zoom(self, zoomLevel: float, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern2::Zoom. Zoom the viewport of the control. zoomLevel: float for int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoom """ ret = self.pattern.Zoom(zoomLevel) == S_OK time.sleep(waitTime) return ret
def Zoom(self, zoomLevel: float, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern2::Zoom. Zoom the viewport of the control. zoomLevel: float for int. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoom """ ret = self.pattern.Zoom(zoomLevel) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTransformPattern2", "::", "Zoom", ".", "Zoom", "the", "viewport", "of", "the", "control", ".", "zoomLevel", ":", "float", "for", "int", ".", "waitTime", ":", "float", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4919-L4930
[ "def", "Zoom", "(", "self", ",", "zoomLevel", ":", "float", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "Zoom", "(", "zoomLevel", ")", "==", "S_OK", "time", ".", "sleep", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TransformPattern2.ZoomByUnit
Call IUIAutomationTransformPattern2::ZoomByUnit. Zoom the viewport of the control by the specified unit. zoomUnit: int, a value in class `ZoomUnit`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoombyunit
uiautomation/uiautomation.py
def ZoomByUnit(self, zoomUnit: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern2::ZoomByUnit. Zoom the viewport of the control by the specified unit. zoomUnit: int, a value in class `ZoomUnit`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoombyunit """ ret = self.pattern.ZoomByUnit(zoomUnit) == S_OK time.sleep(waitTime) return ret
def ZoomByUnit(self, zoomUnit: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTransformPattern2::ZoomByUnit. Zoom the viewport of the control by the specified unit. zoomUnit: int, a value in class `ZoomUnit`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoombyunit """ ret = self.pattern.ZoomByUnit(zoomUnit) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationTransformPattern2", "::", "ZoomByUnit", ".", "Zoom", "the", "viewport", "of", "the", "control", "by", "the", "specified", "unit", ".", "zoomUnit", ":", "int", "a", "value", "in", "class", "ZoomUnit", ".", "waitTime", ":", "float", ".", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4932-L4943
[ "def", "ZoomByUnit", "(", "self", ",", "zoomUnit", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "ZoomByUnit", "(", "zoomUnit", ")", "==", "S_OK", "time", ".", "s...
2cc91060982cc8b777152e698d677cc2989bf263
valid
WindowPattern.SetWindowVisualState
Call IUIAutomationWindowPattern::SetWindowVisualState. Minimize, maximize, or restore the window. state: int, a value in class `WindowVisualState`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-setwindowvisualstate
uiautomation/uiautomation.py
def SetWindowVisualState(self, state: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationWindowPattern::SetWindowVisualState. Minimize, maximize, or restore the window. state: int, a value in class `WindowVisualState`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-setwindowvisualstate """ ret = self.pattern.SetWindowVisualState(state) == S_OK time.sleep(waitTime) return ret
def SetWindowVisualState(self, state: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationWindowPattern::SetWindowVisualState. Minimize, maximize, or restore the window. state: int, a value in class `WindowVisualState`. waitTime: float. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-setwindowvisualstate """ ret = self.pattern.SetWindowVisualState(state) == S_OK time.sleep(waitTime) return ret
[ "Call", "IUIAutomationWindowPattern", "::", "SetWindowVisualState", ".", "Minimize", "maximize", "or", "restore", "the", "window", ".", "state", ":", "int", "a", "value", "in", "class", "WindowVisualState", ".", "waitTime", ":", "float", ".", "Return", "bool", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5081-L5092
[ "def", "SetWindowVisualState", "(", "self", ",", "state", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", "pattern", ".", "SetWindowVisualState", "(", "state", ")", "==", "S_OK", "time...
2cc91060982cc8b777152e698d677cc2989bf263
valid
WindowPattern.WaitForInputIdle
Call IUIAutomationWindowPattern::WaitForInputIdle. Cause the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first. milliseconds: int. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-waitforinputidle
uiautomation/uiautomation.py
def WaitForInputIdle(self, milliseconds: int) -> bool: ''' Call IUIAutomationWindowPattern::WaitForInputIdle. Cause the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first. milliseconds: int. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-waitforinputidle ''' return self.pattern.WaitForInputIdle(milliseconds) == S_OK
def WaitForInputIdle(self, milliseconds: int) -> bool: ''' Call IUIAutomationWindowPattern::WaitForInputIdle. Cause the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first. milliseconds: int. Return bool, True if succeed otherwise False. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-waitforinputidle ''' return self.pattern.WaitForInputIdle(milliseconds) == S_OK
[ "Call", "IUIAutomationWindowPattern", "::", "WaitForInputIdle", ".", "Cause", "the", "calling", "code", "to", "block", "for", "the", "specified", "time", "or", "until", "the", "associated", "process", "enters", "an", "idle", "state", "whichever", "completes", "fir...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5094-L5103
[ "def", "WaitForInputIdle", "(", "self", ",", "milliseconds", ":", "int", ")", "->", "bool", ":", "return", "self", ".", "pattern", ".", "WaitForInputIdle", "(", "milliseconds", ")", "==", "S_OK" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.CreateControlFromElement
Create a concreate `Control` from a com type `IUIAutomationElement`. element: `ctypes.POINTER(IUIAutomationElement)`. Return a subclass of `Control`, an instance of the control's real type.
uiautomation/uiautomation.py
def CreateControlFromElement(element) -> 'Control': """ Create a concreate `Control` from a com type `IUIAutomationElement`. element: `ctypes.POINTER(IUIAutomationElement)`. Return a subclass of `Control`, an instance of the control's real type. """ if element: controlType = element.CurrentControlType if controlType in ControlConstructors: return ControlConstructors[controlType](element=element) else: Logger.WriteLine("element.CurrentControlType returns {}, invalid ControlType!".format(controlType), ConsoleColor.Red)
def CreateControlFromElement(element) -> 'Control': """ Create a concreate `Control` from a com type `IUIAutomationElement`. element: `ctypes.POINTER(IUIAutomationElement)`. Return a subclass of `Control`, an instance of the control's real type. """ if element: controlType = element.CurrentControlType if controlType in ControlConstructors: return ControlConstructors[controlType](element=element) else: Logger.WriteLine("element.CurrentControlType returns {}, invalid ControlType!".format(controlType), ConsoleColor.Red)
[ "Create", "a", "concreate", "Control", "from", "a", "com", "type", "IUIAutomationElement", ".", "element", ":", "ctypes", ".", "POINTER", "(", "IUIAutomationElement", ")", ".", "Return", "a", "subclass", "of", "Control", "an", "instance", "of", "the", "control...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5192-L5203
[ "def", "CreateControlFromElement", "(", "element", ")", "->", "'Control'", ":", "if", "element", ":", "controlType", "=", "element", ".", "CurrentControlType", "if", "controlType", "in", "ControlConstructors", ":", "return", "ControlConstructors", "[", "controlType", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.AddSearchProperties
Add search properties using `dict.update`. searchProperties: dict, same as searchProperties in `Control.__init__`.
uiautomation/uiautomation.py
def AddSearchProperties(self, **searchProperties) -> None: """ Add search properties using `dict.update`. searchProperties: dict, same as searchProperties in `Control.__init__`. """ self.searchProperties.update(searchProperties) if 'Depth' in searchProperties: self.searchDepth = searchProperties['Depth'] if 'RegexName' in searchProperties: regName = searchProperties['RegexName'] self.regexName = re.compile(regName) if regName else None
def AddSearchProperties(self, **searchProperties) -> None: """ Add search properties using `dict.update`. searchProperties: dict, same as searchProperties in `Control.__init__`. """ self.searchProperties.update(searchProperties) if 'Depth' in searchProperties: self.searchDepth = searchProperties['Depth'] if 'RegexName' in searchProperties: regName = searchProperties['RegexName'] self.regexName = re.compile(regName) if regName else None
[ "Add", "search", "properties", "using", "dict", ".", "update", ".", "searchProperties", ":", "dict", "same", "as", "searchProperties", "in", "Control", ".", "__init__", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5223-L5233
[ "def", "AddSearchProperties", "(", "self", ",", "*", "*", "searchProperties", ")", "->", "None", ":", "self", ".", "searchProperties", ".", "update", "(", "searchProperties", ")", "if", "'Depth'", "in", "searchProperties", ":", "self", ".", "searchDepth", "=",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.RemoveSearchProperties
searchProperties: dict, same as searchProperties in `Control.__init__`.
uiautomation/uiautomation.py
def RemoveSearchProperties(self, **searchProperties) -> None: """ searchProperties: dict, same as searchProperties in `Control.__init__`. """ for key in searchProperties: del self.searchProperties[key] if key == 'RegexName': self.regexName = None
def RemoveSearchProperties(self, **searchProperties) -> None: """ searchProperties: dict, same as searchProperties in `Control.__init__`. """ for key in searchProperties: del self.searchProperties[key] if key == 'RegexName': self.regexName = None
[ "searchProperties", ":", "dict", "same", "as", "searchProperties", "in", "Control", ".", "__init__", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5235-L5242
[ "def", "RemoveSearchProperties", "(", "self", ",", "*", "*", "searchProperties", ")", "->", "None", ":", "for", "key", "in", "searchProperties", ":", "del", "self", ".", "searchProperties", "[", "key", "]", "if", "key", "==", "'RegexName'", ":", "self", "....
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetColorfulSearchPropertiesStr
keyColor, valueColor: str, color name in class ConsoleColor
uiautomation/uiautomation.py
def GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str: """keyColor, valueColor: str, color name in class ConsoleColor""" strs = ['<Color={}>{}</Color>: <Color={}>{}</Color>'.format(keyColor if k in Control.ValidKeys else 'DarkYellow', k, valueColor, ControlTypeNames[v] if k == 'ControlType' else repr(v)) for k, v in self.searchProperties.items()] return '{' + ', '.join(strs) + '}'
def GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str: """keyColor, valueColor: str, color name in class ConsoleColor""" strs = ['<Color={}>{}</Color>: <Color={}>{}</Color>'.format(keyColor if k in Control.ValidKeys else 'DarkYellow', k, valueColor, ControlTypeNames[v] if k == 'ControlType' else repr(v)) for k, v in self.searchProperties.items()] return '{' + ', '.join(strs) + '}'
[ "keyColor", "valueColor", ":", "str", "color", "name", "in", "class", "ConsoleColor" ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5248-L5252
[ "def", "GetColorfulSearchPropertiesStr", "(", "self", ",", "keyColor", "=", "'DarkGreen'", ",", "valueColor", "=", "'DarkCyan'", ")", "->", "str", ":", "strs", "=", "[", "'<Color={}>{}</Color>: <Color={}>{}</Color>'", ".", "format", "(", "keyColor", "if", "k", "in...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.BoundingRectangle
Property BoundingRectangle. Call IUIAutomationElement::get_CurrentBoundingRectangle. Return `Rect`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentboundingrectangle rect = control.BoundingRectangle print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter())
uiautomation/uiautomation.py
def BoundingRectangle(self) -> Rect: """ Property BoundingRectangle. Call IUIAutomationElement::get_CurrentBoundingRectangle. Return `Rect`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentboundingrectangle rect = control.BoundingRectangle print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter()) """ rect = self.Element.CurrentBoundingRectangle return Rect(rect.left, rect.top, rect.right, rect.bottom)
def BoundingRectangle(self) -> Rect: """ Property BoundingRectangle. Call IUIAutomationElement::get_CurrentBoundingRectangle. Return `Rect`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentboundingrectangle rect = control.BoundingRectangle print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter()) """ rect = self.Element.CurrentBoundingRectangle return Rect(rect.left, rect.top, rect.right, rect.bottom)
[ "Property", "BoundingRectangle", ".", "Call", "IUIAutomationElement", "::", "get_CurrentBoundingRectangle", ".", "Return", "Rect", ".", "Refer", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "windows", "/", "desktop", "/"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5334-L5345
[ "def", "BoundingRectangle", "(", "self", ")", "->", "Rect", ":", "rect", "=", "self", ".", "Element", ".", "CurrentBoundingRectangle", "return", "Rect", "(", "rect", ".", "left", ",", "rect", ".", "top", ",", "rect", ".", "right", ",", "rect", ".", "bo...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetClickablePoint
Call IUIAutomationElement::GetClickablePoint. Return tuple, (x: int, y: int, gotClickable: bool), like (20, 10, True) Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
uiautomation/uiautomation.py
def GetClickablePoint(self) -> tuple: """ Call IUIAutomationElement::GetClickablePoint. Return tuple, (x: int, y: int, gotClickable: bool), like (20, 10, True) Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint """ point, gotClickable = self.Element.GetClickablePoint() return (point.x, point.y, bool(gotClickable))
def GetClickablePoint(self) -> tuple: """ Call IUIAutomationElement::GetClickablePoint. Return tuple, (x: int, y: int, gotClickable: bool), like (20, 10, True) Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint """ point, gotClickable = self.Element.GetClickablePoint() return (point.x, point.y, bool(gotClickable))
[ "Call", "IUIAutomationElement", "::", "GetClickablePoint", ".", "Return", "tuple", "(", "x", ":", "int", "y", ":", "int", "gotClickable", ":", "bool", ")", "like", "(", "20", "10", "True", ")", "Refer", "https", ":", "//", "docs", ".", "microsoft", ".", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5576-L5583
[ "def", "GetClickablePoint", "(", "self", ")", "->", "tuple", ":", "point", ",", "gotClickable", "=", "self", ".", "Element", ".", "GetClickablePoint", "(", ")", "return", "(", "point", ".", "x", ",", "point", ".", "y", ",", "bool", "(", "gotClickable", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetPattern
Call IUIAutomationElement::GetCurrentPattern. Get a new pattern by pattern id if it supports the pattern. patternId: int, a value in class `PatternId`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
uiautomation/uiautomation.py
def GetPattern(self, patternId: int): """ Call IUIAutomationElement::GetCurrentPattern. Get a new pattern by pattern id if it supports the pattern. patternId: int, a value in class `PatternId`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern """ try: pattern = self.Element.GetCurrentPattern(patternId) if pattern: subPattern = CreatePattern(patternId, pattern) self._supportedPatterns[patternId] = subPattern return subPattern except comtypes.COMError as ex: pass
def GetPattern(self, patternId: int): """ Call IUIAutomationElement::GetCurrentPattern. Get a new pattern by pattern id if it supports the pattern. patternId: int, a value in class `PatternId`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern """ try: pattern = self.Element.GetCurrentPattern(patternId) if pattern: subPattern = CreatePattern(patternId, pattern) self._supportedPatterns[patternId] = subPattern return subPattern except comtypes.COMError as ex: pass
[ "Call", "IUIAutomationElement", "::", "GetCurrentPattern", ".", "Get", "a", "new", "pattern", "by", "pattern", "id", "if", "it", "supports", "the", "pattern", ".", "patternId", ":", "int", "a", "value", "in", "class", "PatternId", ".", "Refer", "https", ":",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5585-L5599
[ "def", "GetPattern", "(", "self", ",", "patternId", ":", "int", ")", ":", "try", ":", "pattern", "=", "self", ".", "Element", ".", "GetCurrentPattern", "(", "patternId", ")", "if", "pattern", ":", "subPattern", "=", "CreatePattern", "(", "patternId", ",", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetPatternAs
Call IUIAutomationElement::GetCurrentPatternAs. Get a new pattern by pattern id if it supports the pattern, todo. patternId: int, a value in class `PatternId`. riid: GUID. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
uiautomation/uiautomation.py
def GetPatternAs(self, patternId: int, riid): """ Call IUIAutomationElement::GetCurrentPatternAs. Get a new pattern by pattern id if it supports the pattern, todo. patternId: int, a value in class `PatternId`. riid: GUID. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas """ return self.Element.GetCurrentPatternAs(patternId, riid)
def GetPatternAs(self, patternId: int, riid): """ Call IUIAutomationElement::GetCurrentPatternAs. Get a new pattern by pattern id if it supports the pattern, todo. patternId: int, a value in class `PatternId`. riid: GUID. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas """ return self.Element.GetCurrentPatternAs(patternId, riid)
[ "Call", "IUIAutomationElement", "::", "GetCurrentPatternAs", ".", "Get", "a", "new", "pattern", "by", "pattern", "id", "if", "it", "supports", "the", "pattern", "todo", ".", "patternId", ":", "int", "a", "value", "in", "class", "PatternId", ".", "riid", ":",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5601-L5609
[ "def", "GetPatternAs", "(", "self", ",", "patternId", ":", "int", ",", "riid", ")", ":", "return", "self", ".", "Element", ".", "GetCurrentPatternAs", "(", "patternId", ",", "riid", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetPropertyValueEx
Call IUIAutomationElement::GetCurrentPropertyValueEx. propertyId: int, a value in class `PropertyId`. ignoreDefaultValue: int, 0 or 1. Return Any, corresponding type according to propertyId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
uiautomation/uiautomation.py
def GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any: """ Call IUIAutomationElement::GetCurrentPropertyValueEx. propertyId: int, a value in class `PropertyId`. ignoreDefaultValue: int, 0 or 1. Return Any, corresponding type according to propertyId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex """ return self.Element.GetCurrentPropertyValueEx(propertyId, ignoreDefaultValue)
def GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any: """ Call IUIAutomationElement::GetCurrentPropertyValueEx. propertyId: int, a value in class `PropertyId`. ignoreDefaultValue: int, 0 or 1. Return Any, corresponding type according to propertyId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex """ return self.Element.GetCurrentPropertyValueEx(propertyId, ignoreDefaultValue)
[ "Call", "IUIAutomationElement", "::", "GetCurrentPropertyValueEx", ".", "propertyId", ":", "int", "a", "value", "in", "class", "PropertyId", ".", "ignoreDefaultValue", ":", "int", "0", "or", "1", ".", "Return", "Any", "corresponding", "type", "according", "to", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5620-L5628
[ "def", "GetPropertyValueEx", "(", "self", ",", "propertyId", ":", "int", ",", "ignoreDefaultValue", ":", "int", ")", "->", "Any", ":", "return", "self", ".", "Element", ".", "GetCurrentPropertyValueEx", "(", "propertyId", ",", "ignoreDefaultValue", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Element
Property Element. Return `ctypes.POINTER(IUIAutomationElement)`.
uiautomation/uiautomation.py
def Element(self): """ Property Element. Return `ctypes.POINTER(IUIAutomationElement)`. """ if not self._element: self.Refind(maxSearchSeconds=TIME_OUT_SECOND, searchIntervalSeconds=self.searchWaitTime) return self._element
def Element(self): """ Property Element. Return `ctypes.POINTER(IUIAutomationElement)`. """ if not self._element: self.Refind(maxSearchSeconds=TIME_OUT_SECOND, searchIntervalSeconds=self.searchWaitTime) return self._element
[ "Property", "Element", ".", "Return", "ctypes", ".", "POINTER", "(", "IUIAutomationElement", ")", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5649-L5656
[ "def", "Element", "(", "self", ")", ":", "if", "not", "self", ".", "_element", ":", "self", ".", "Refind", "(", "maxSearchSeconds", "=", "TIME_OUT_SECOND", ",", "searchIntervalSeconds", "=", "self", ".", "searchWaitTime", ")", "return", "self", ".", "_elemen...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetCachedPattern
Get a pattern by patternId. patternId: int, a value in class `PatternId`. Return a pattern if it supports the pattern else None. cache: bool, if True, store the pattern for later use, if False, get a new pattern by `self.GetPattern`.
uiautomation/uiautomation.py
def GetCachedPattern(self, patternId: int, cache: bool): """ Get a pattern by patternId. patternId: int, a value in class `PatternId`. Return a pattern if it supports the pattern else None. cache: bool, if True, store the pattern for later use, if False, get a new pattern by `self.GetPattern`. """ if cache: pattern = self._supportedPatterns.get(patternId, None) if pattern: return pattern else: pattern = self.GetPattern(patternId) if pattern: self._supportedPatterns[patternId] = pattern return pattern else: pattern = self.GetPattern(patternId) if pattern: self._supportedPatterns[patternId] = pattern return pattern
def GetCachedPattern(self, patternId: int, cache: bool): """ Get a pattern by patternId. patternId: int, a value in class `PatternId`. Return a pattern if it supports the pattern else None. cache: bool, if True, store the pattern for later use, if False, get a new pattern by `self.GetPattern`. """ if cache: pattern = self._supportedPatterns.get(patternId, None) if pattern: return pattern else: pattern = self.GetPattern(patternId) if pattern: self._supportedPatterns[patternId] = pattern return pattern else: pattern = self.GetPattern(patternId) if pattern: self._supportedPatterns[patternId] = pattern return pattern
[ "Get", "a", "pattern", "by", "patternId", ".", "patternId", ":", "int", "a", "value", "in", "class", "PatternId", ".", "Return", "a", "pattern", "if", "it", "supports", "the", "pattern", "else", "None", ".", "cache", ":", "bool", "if", "True", "store", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5665-L5685
[ "def", "GetCachedPattern", "(", "self", ",", "patternId", ":", "int", ",", "cache", ":", "bool", ")", ":", "if", "cache", ":", "pattern", "=", "self", ".", "_supportedPatterns", ".", "get", "(", "patternId", ",", "None", ")", "if", "pattern", ":", "ret...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetAncestorControl
Get a ancestor control that matches the condition. condition: Callable, function (control: Control, depth: int)->bool, depth starts with -1 and decreses when search goes up. Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetAncestorControl(self, condition: Callable) -> 'Control': """ Get a ancestor control that matches the condition. condition: Callable, function (control: Control, depth: int)->bool, depth starts with -1 and decreses when search goes up. Return `Control` subclass or None. """ ancestor = self depth = 0 while True: ancestor = ancestor.GetParentControl() depth -= 1 if ancestor: if condition(ancestor, depth): return ancestor else: break
def GetAncestorControl(self, condition: Callable) -> 'Control': """ Get a ancestor control that matches the condition. condition: Callable, function (control: Control, depth: int)->bool, depth starts with -1 and decreses when search goes up. Return `Control` subclass or None. """ ancestor = self depth = 0 while True: ancestor = ancestor.GetParentControl() depth -= 1 if ancestor: if condition(ancestor, depth): return ancestor else: break
[ "Get", "a", "ancestor", "control", "that", "matches", "the", "condition", ".", "condition", ":", "Callable", "function", "(", "control", ":", "Control", "depth", ":", "int", ")", "-", ">", "bool", "depth", "starts", "with", "-", "1", "and", "decreses", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5693-L5709
[ "def", "GetAncestorControl", "(", "self", ",", "condition", ":", "Callable", ")", "->", "'Control'", ":", "ancestor", "=", "self", "depth", "=", "0", "while", "True", ":", "ancestor", "=", "ancestor", ".", "GetParentControl", "(", ")", "depth", "-=", "1", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetParentControl
Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetParentControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetParentElement(self.Element) return Control.CreateControlFromElement(ele)
def GetParentControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetParentElement(self.Element) return Control.CreateControlFromElement(ele)
[ "Return", "Control", "subclass", "or", "None", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5711-L5716
[ "def", "GetParentControl", "(", "self", ")", "->", "'Control'", ":", "ele", "=", "_AutomationClient", ".", "instance", "(", ")", ".", "ViewWalker", ".", "GetParentElement", "(", "self", ".", "Element", ")", "return", "Control", ".", "CreateControlFromElement", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetFirstChildControl
Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetFirstChildControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetFirstChildElement(self.Element) return Control.CreateControlFromElement(ele)
def GetFirstChildControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetFirstChildElement(self.Element) return Control.CreateControlFromElement(ele)
[ "Return", "Control", "subclass", "or", "None", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5718-L5723
[ "def", "GetFirstChildControl", "(", "self", ")", "->", "'Control'", ":", "ele", "=", "_AutomationClient", ".", "instance", "(", ")", ".", "ViewWalker", ".", "GetFirstChildElement", "(", "self", ".", "Element", ")", "return", "Control", ".", "CreateControlFromEle...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetLastChildControl
Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetLastChildControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetLastChildElement(self.Element) return Control.CreateControlFromElement(ele)
def GetLastChildControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetLastChildElement(self.Element) return Control.CreateControlFromElement(ele)
[ "Return", "Control", "subclass", "or", "None", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5725-L5730
[ "def", "GetLastChildControl", "(", "self", ")", "->", "'Control'", ":", "ele", "=", "_AutomationClient", ".", "instance", "(", ")", ".", "ViewWalker", ".", "GetLastChildElement", "(", "self", ".", "Element", ")", "return", "Control", ".", "CreateControlFromEleme...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetNextSiblingControl
Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetNextSiblingControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetNextSiblingElement(self.Element) return Control.CreateControlFromElement(ele)
def GetNextSiblingControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetNextSiblingElement(self.Element) return Control.CreateControlFromElement(ele)
[ "Return", "Control", "subclass", "or", "None", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5732-L5737
[ "def", "GetNextSiblingControl", "(", "self", ")", "->", "'Control'", ":", "ele", "=", "_AutomationClient", ".", "instance", "(", ")", ".", "ViewWalker", ".", "GetNextSiblingElement", "(", "self", ".", "Element", ")", "return", "Control", ".", "CreateControlFromE...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetPreviousSiblingControl
Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetPreviousSiblingControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetPreviousSiblingElement(self.Element) return Control.CreateControlFromElement(ele)
def GetPreviousSiblingControl(self) -> 'Control': """ Return `Control` subclass or None. """ ele = _AutomationClient.instance().ViewWalker.GetPreviousSiblingElement(self.Element) return Control.CreateControlFromElement(ele)
[ "Return", "Control", "subclass", "or", "None", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5739-L5744
[ "def", "GetPreviousSiblingControl", "(", "self", ")", "->", "'Control'", ":", "ele", "=", "_AutomationClient", ".", "instance", "(", ")", ".", "ViewWalker", ".", "GetPreviousSiblingElement", "(", "self", ".", "Element", ")", "return", "Control", ".", "CreateCont...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetSiblingControl
Find a SiblingControl by condition(control: Control)->bool. forward: bool, if True, only search next siblings, if False, search pervious siblings first, then search next siblings. condition: Callable, function (control: Control)->bool. Return `Control` subclass or None.
uiautomation/uiautomation.py
def GetSiblingControl(self, condition: Callable, forward: bool = True) -> 'Control': """ Find a SiblingControl by condition(control: Control)->bool. forward: bool, if True, only search next siblings, if False, search pervious siblings first, then search next siblings. condition: Callable, function (control: Control)->bool. Return `Control` subclass or None. """ if not forward: prev = self while True: prev = prev.GetPreviousSiblingControl() if prev: if condition(prev): return prev else: break next_ = self while True: next_ = next_.GetNextSiblingControl() if next_: if condition(next_): return next_ else: break
def GetSiblingControl(self, condition: Callable, forward: bool = True) -> 'Control': """ Find a SiblingControl by condition(control: Control)->bool. forward: bool, if True, only search next siblings, if False, search pervious siblings first, then search next siblings. condition: Callable, function (control: Control)->bool. Return `Control` subclass or None. """ if not forward: prev = self while True: prev = prev.GetPreviousSiblingControl() if prev: if condition(prev): return prev else: break next_ = self while True: next_ = next_.GetNextSiblingControl() if next_: if condition(next_): return next_ else: break
[ "Find", "a", "SiblingControl", "by", "condition", "(", "control", ":", "Control", ")", "-", ">", "bool", ".", "forward", ":", "bool", "if", "True", "only", "search", "next", "siblings", "if", "False", "search", "pervious", "siblings", "first", "then", "sea...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5746-L5769
[ "def", "GetSiblingControl", "(", "self", ",", "condition", ":", "Callable", ",", "forward", ":", "bool", "=", "True", ")", "->", "'Control'", ":", "if", "not", "forward", ":", "prev", "=", "self", "while", "True", ":", "prev", "=", "prev", ".", "GetPre...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetChildren
Return list, a list of `Control` subclasses.
uiautomation/uiautomation.py
def GetChildren(self) -> list: """ Return list, a list of `Control` subclasses. """ children = [] child = self.GetFirstChildControl() while child: children.append(child) child = child.GetNextSiblingControl() return children
def GetChildren(self) -> list: """ Return list, a list of `Control` subclasses. """ children = [] child = self.GetFirstChildControl() while child: children.append(child) child = child.GetNextSiblingControl() return children
[ "Return", "list", "a", "list", "of", "Control", "subclasses", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5771-L5780
[ "def", "GetChildren", "(", "self", ")", "->", "list", ":", "children", "=", "[", "]", "child", "=", "self", ".", "GetFirstChildControl", "(", ")", "while", "child", ":", "children", ".", "append", "(", "child", ")", "child", "=", "child", ".", "GetNext...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control._CompareFunction
Define how to search. control: `Control` or its subclass. depth: int, tree depth from searchFromControl. Return bool.
uiautomation/uiautomation.py
def _CompareFunction(self, control: 'Control', depth: int) -> bool: """ Define how to search. control: `Control` or its subclass. depth: int, tree depth from searchFromControl. Return bool. """ for key, value in self.searchProperties.items(): if 'ControlType' == key: if value != control.ControlType: return False elif 'ClassName' == key: if value != control.ClassName: return False elif 'AutomationId' == key: if value != control.AutomationId: return False elif 'Name' == key: if value != control.Name: return False elif 'SubName' == key: if value not in control.Name: return False elif 'RegexName' == key: if not self.regexName.match(control.Name): return False elif 'Depth' == key: if value != depth: return False elif 'Compare' == key: if not value(control, depth): return False return True
def _CompareFunction(self, control: 'Control', depth: int) -> bool: """ Define how to search. control: `Control` or its subclass. depth: int, tree depth from searchFromControl. Return bool. """ for key, value in self.searchProperties.items(): if 'ControlType' == key: if value != control.ControlType: return False elif 'ClassName' == key: if value != control.ClassName: return False elif 'AutomationId' == key: if value != control.AutomationId: return False elif 'Name' == key: if value != control.Name: return False elif 'SubName' == key: if value not in control.Name: return False elif 'RegexName' == key: if not self.regexName.match(control.Name): return False elif 'Depth' == key: if value != depth: return False elif 'Compare' == key: if not value(control, depth): return False return True
[ "Define", "how", "to", "search", ".", "control", ":", "Control", "or", "its", "subclass", ".", "depth", ":", "int", "tree", "depth", "from", "searchFromControl", ".", "Return", "bool", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5782-L5814
[ "def", "_CompareFunction", "(", "self", ",", "control", ":", "'Control'", ",", "depth", ":", "int", ")", "->", "bool", ":", "for", "key", ",", "value", "in", "self", ".", "searchProperties", ".", "items", "(", ")", ":", "if", "'ControlType'", "==", "ke...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Exists
maxSearchSeconds: float searchIntervalSeconds: float Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if find
uiautomation/uiautomation.py
def Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = SEARCH_INTERVAL, printIfNotExist: bool = False) -> bool: """ maxSearchSeconds: float searchIntervalSeconds: float Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if find """ if self._element and self._elementDirectAssign: #if element is directly assigned, not by searching, just check whether self._element is valid #but I can't find an API in UIAutomation that can directly check rootElement = GetRootControl().Element if self._element == rootElement: return True else: parentElement = _AutomationClient.instance().ViewWalker.GetParentElement(self._element) if parentElement: return True else: return False #find the element if len(self.searchProperties) == 0: raise LookupError("control's searchProperties must not be empty!") self._element = None startTime = ProcessTime() # Use same timeout(s) parameters for resolve all parents prev = self.searchFromControl if prev and not prev._element and not prev.Exists(maxSearchSeconds, searchIntervalSeconds): if printIfNotExist or DEBUG_EXIST_DISAPPEAR: Logger.ColorfullyWriteLine(self.GetColorfulSearchPropertiesStr() + '<Color=Red> does not exist.</Color>') return False startTime2 = ProcessTime() if DEBUG_SEARCH_TIME: startDateTime = datetime.datetime.now() while True: control = FindControl(self.searchFromControl, self._CompareFunction, self.searchDepth, False, self.foundIndex) if control: self._element = control.Element control._element = 0 # control will be destroyed, but the element needs to be stroed in self._element if DEBUG_SEARCH_TIME: Logger.ColorfullyWriteLine('{} TraverseControls: <Color=Cyan>{}</Color>, SearchTime: <Color=Cyan>{:.3f}</Color>s[{} - {}]'.format( self.GetColorfulSearchPropertiesStr(), control.traverseCount, ProcessTime() - startTime2, startDateTime.time(), datetime.datetime.now().time())) return True else: remain = startTime + maxSearchSeconds - ProcessTime() if remain > 0: time.sleep(min(remain, searchIntervalSeconds)) else: if printIfNotExist or DEBUG_EXIST_DISAPPEAR: Logger.ColorfullyWriteLine(self.GetColorfulSearchPropertiesStr() + '<Color=Red> does not exist.</Color>') return False
def Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = SEARCH_INTERVAL, printIfNotExist: bool = False) -> bool: """ maxSearchSeconds: float searchIntervalSeconds: float Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if find """ if self._element and self._elementDirectAssign: #if element is directly assigned, not by searching, just check whether self._element is valid #but I can't find an API in UIAutomation that can directly check rootElement = GetRootControl().Element if self._element == rootElement: return True else: parentElement = _AutomationClient.instance().ViewWalker.GetParentElement(self._element) if parentElement: return True else: return False #find the element if len(self.searchProperties) == 0: raise LookupError("control's searchProperties must not be empty!") self._element = None startTime = ProcessTime() # Use same timeout(s) parameters for resolve all parents prev = self.searchFromControl if prev and not prev._element and not prev.Exists(maxSearchSeconds, searchIntervalSeconds): if printIfNotExist or DEBUG_EXIST_DISAPPEAR: Logger.ColorfullyWriteLine(self.GetColorfulSearchPropertiesStr() + '<Color=Red> does not exist.</Color>') return False startTime2 = ProcessTime() if DEBUG_SEARCH_TIME: startDateTime = datetime.datetime.now() while True: control = FindControl(self.searchFromControl, self._CompareFunction, self.searchDepth, False, self.foundIndex) if control: self._element = control.Element control._element = 0 # control will be destroyed, but the element needs to be stroed in self._element if DEBUG_SEARCH_TIME: Logger.ColorfullyWriteLine('{} TraverseControls: <Color=Cyan>{}</Color>, SearchTime: <Color=Cyan>{:.3f}</Color>s[{} - {}]'.format( self.GetColorfulSearchPropertiesStr(), control.traverseCount, ProcessTime() - startTime2, startDateTime.time(), datetime.datetime.now().time())) return True else: remain = startTime + maxSearchSeconds - ProcessTime() if remain > 0: time.sleep(min(remain, searchIntervalSeconds)) else: if printIfNotExist or DEBUG_EXIST_DISAPPEAR: Logger.ColorfullyWriteLine(self.GetColorfulSearchPropertiesStr() + '<Color=Red> does not exist.</Color>') return False
[ "maxSearchSeconds", ":", "float", "searchIntervalSeconds", ":", "float", "Find", "control", "every", "searchIntervalSeconds", "seconds", "in", "maxSearchSeconds", "seconds", ".", "Return", "bool", "True", "if", "find" ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5816-L5866
[ "def", "Exists", "(", "self", ",", "maxSearchSeconds", ":", "float", "=", "5", ",", "searchIntervalSeconds", ":", "float", "=", "SEARCH_INTERVAL", ",", "printIfNotExist", ":", "bool", "=", "False", ")", "->", "bool", ":", "if", "self", ".", "_element", "an...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Disappears
maxSearchSeconds: float searchIntervalSeconds: float Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if control disappears.
uiautomation/uiautomation.py
def Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = SEARCH_INTERVAL, printIfNotDisappear: bool = False) -> bool: """ maxSearchSeconds: float searchIntervalSeconds: float Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if control disappears. """ global DEBUG_EXIST_DISAPPEAR start = ProcessTime() while True: temp = DEBUG_EXIST_DISAPPEAR DEBUG_EXIST_DISAPPEAR = False # do not print for Exists if not self.Exists(0, 0, False): DEBUG_EXIST_DISAPPEAR = temp return True DEBUG_EXIST_DISAPPEAR = temp remain = start + maxSearchSeconds - ProcessTime() if remain > 0: time.sleep(min(remain, searchIntervalSeconds)) else: if printIfNotDisappear or DEBUG_EXIST_DISAPPEAR: Logger.ColorfullyWriteLine(self.GetColorfulSearchPropertiesStr() + '<Color=Red> does not disappear.</Color>') return False
def Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = SEARCH_INTERVAL, printIfNotDisappear: bool = False) -> bool: """ maxSearchSeconds: float searchIntervalSeconds: float Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if control disappears. """ global DEBUG_EXIST_DISAPPEAR start = ProcessTime() while True: temp = DEBUG_EXIST_DISAPPEAR DEBUG_EXIST_DISAPPEAR = False # do not print for Exists if not self.Exists(0, 0, False): DEBUG_EXIST_DISAPPEAR = temp return True DEBUG_EXIST_DISAPPEAR = temp remain = start + maxSearchSeconds - ProcessTime() if remain > 0: time.sleep(min(remain, searchIntervalSeconds)) else: if printIfNotDisappear or DEBUG_EXIST_DISAPPEAR: Logger.ColorfullyWriteLine(self.GetColorfulSearchPropertiesStr() + '<Color=Red> does not disappear.</Color>') return False
[ "maxSearchSeconds", ":", "float", "searchIntervalSeconds", ":", "float", "Check", "if", "control", "disappears", "every", "searchIntervalSeconds", "seconds", "in", "maxSearchSeconds", "seconds", ".", "Return", "bool", "True", "if", "control", "disappears", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5868-L5890
[ "def", "Disappears", "(", "self", ",", "maxSearchSeconds", ":", "float", "=", "5", ",", "searchIntervalSeconds", ":", "float", "=", "SEARCH_INTERVAL", ",", "printIfNotDisappear", ":", "bool", "=", "False", ")", "->", "bool", ":", "global", "DEBUG_EXIST_DISAPPEAR...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Refind
Refind the control every searchIntervalSeconds seconds in maxSearchSeconds seconds. maxSearchSeconds: float. searchIntervalSeconds: float. raiseException: bool, if True, raise a LookupError if timeout. Return bool, True if find.
uiautomation/uiautomation.py
def Refind(self, maxSearchSeconds: float = TIME_OUT_SECOND, searchIntervalSeconds: float = SEARCH_INTERVAL, raiseException: bool = True) -> bool: """ Refind the control every searchIntervalSeconds seconds in maxSearchSeconds seconds. maxSearchSeconds: float. searchIntervalSeconds: float. raiseException: bool, if True, raise a LookupError if timeout. Return bool, True if find. """ if not self.Exists(maxSearchSeconds, searchIntervalSeconds, False if raiseException else DEBUG_EXIST_DISAPPEAR): if raiseException: Logger.ColorfullyWriteLine('<Color=Red>Find Control Timeout: </Color>' + self.GetColorfulSearchPropertiesStr()) raise LookupError('Find Control Timeout: ' + self.GetSearchPropertiesStr()) else: return False return True
def Refind(self, maxSearchSeconds: float = TIME_OUT_SECOND, searchIntervalSeconds: float = SEARCH_INTERVAL, raiseException: bool = True) -> bool: """ Refind the control every searchIntervalSeconds seconds in maxSearchSeconds seconds. maxSearchSeconds: float. searchIntervalSeconds: float. raiseException: bool, if True, raise a LookupError if timeout. Return bool, True if find. """ if not self.Exists(maxSearchSeconds, searchIntervalSeconds, False if raiseException else DEBUG_EXIST_DISAPPEAR): if raiseException: Logger.ColorfullyWriteLine('<Color=Red>Find Control Timeout: </Color>' + self.GetColorfulSearchPropertiesStr()) raise LookupError('Find Control Timeout: ' + self.GetSearchPropertiesStr()) else: return False return True
[ "Refind", "the", "control", "every", "searchIntervalSeconds", "seconds", "in", "maxSearchSeconds", "seconds", ".", "maxSearchSeconds", ":", "float", ".", "searchIntervalSeconds", ":", "float", ".", "raiseException", ":", "bool", "if", "True", "raise", "a", "LookupEr...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5892-L5906
[ "def", "Refind", "(", "self", ",", "maxSearchSeconds", ":", "float", "=", "TIME_OUT_SECOND", ",", "searchIntervalSeconds", ":", "float", "=", "SEARCH_INTERVAL", ",", "raiseException", ":", "bool", "=", "True", ")", "->", "bool", ":", "if", "not", "self", "."...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.MoveCursorToInnerPos
Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move to self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool. Return tuple, two ints(x,y), the cursor positon relative to screen(0,0) after moving or None if control's width or height == 0.
uiautomation/uiautomation.py
def MoveCursorToInnerPos(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> tuple: """ Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move to self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool. Return tuple, two ints(x,y), the cursor positon relative to screen(0,0) after moving or None if control's width or height == 0. """ rect = self.BoundingRectangle if rect.width() == 0 or rect.height() == 0: Logger.ColorfullyWriteLine('<Color=Yellow>Can not move curosr</Color>. {}\'s BoundingRectangle is {}. SearchProperties: {}'.format( self.ControlTypeName, rect, self.GetColorfulSearchPropertiesStr())) return if x is None: x = rect.left + int(rect.width() * ratioX) else: x = (rect.left if x >= 0 else rect.right) + x if y is None: y = rect.top + int(rect.height() * ratioY) else: y = (rect.top if y >= 0 else rect.bottom) + y if simulateMove and MAX_MOVE_SECOND > 0: MoveTo(x, y, waitTime=0) else: SetCursorPos(x, y) return x, y
def MoveCursorToInnerPos(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> tuple: """ Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move to self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool. Return tuple, two ints(x,y), the cursor positon relative to screen(0,0) after moving or None if control's width or height == 0. """ rect = self.BoundingRectangle if rect.width() == 0 or rect.height() == 0: Logger.ColorfullyWriteLine('<Color=Yellow>Can not move curosr</Color>. {}\'s BoundingRectangle is {}. SearchProperties: {}'.format( self.ControlTypeName, rect, self.GetColorfulSearchPropertiesStr())) return if x is None: x = rect.left + int(rect.width() * ratioX) else: x = (rect.left if x >= 0 else rect.right) + x if y is None: y = rect.top + int(rect.height() * ratioY) else: y = (rect.top if y >= 0 else rect.bottom) + y if simulateMove and MAX_MOVE_SECOND > 0: MoveTo(x, y, waitTime=0) else: SetCursorPos(x, y) return x, y
[ "Move", "cursor", "to", "control", "s", "internal", "position", "default", "to", "center", ".", "x", ":", "int", "if", "<", "0", "move", "to", "self", ".", "BoundingRectangle", ".", "right", "+", "x", "if", "not", "None", "ignore", "ratioX", ".", "y", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5908-L5935
[ "def", "MoveCursorToInnerPos", "(", "self", ",", "x", ":", "int", "=", "None", ",", "y", ":", "int", "=", "None", ",", "ratioX", ":", "float", "=", "0.5", ",", "ratioY", ":", "float", "=", "0.5", ",", "simulateMove", ":", "bool", "=", "True", ")", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.MoveCursorToMyCenter
Move cursor to control's center. Return tuple, two ints tuple(x,y), the cursor positon relative to screen(0,0) after moving .
uiautomation/uiautomation.py
def MoveCursorToMyCenter(self, simulateMove: bool = True) -> tuple: """ Move cursor to control's center. Return tuple, two ints tuple(x,y), the cursor positon relative to screen(0,0) after moving . """ return self.MoveCursorToInnerPos(simulateMove=simulateMove)
def MoveCursorToMyCenter(self, simulateMove: bool = True) -> tuple: """ Move cursor to control's center. Return tuple, two ints tuple(x,y), the cursor positon relative to screen(0,0) after moving . """ return self.MoveCursorToInnerPos(simulateMove=simulateMove)
[ "Move", "cursor", "to", "control", "s", "center", ".", "Return", "tuple", "two", "ints", "tuple", "(", "x", "y", ")", "the", "cursor", "positon", "relative", "to", "screen", "(", "0", "0", ")", "after", "moving", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5937-L5942
[ "def", "MoveCursorToMyCenter", "(", "self", ",", "simulateMove", ":", "bool", "=", "True", ")", "->", "tuple", ":", "return", "self", ".", "MoveCursorToInnerPos", "(", "simulateMove", "=", "simulateMove", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Click
x: int, if < 0, click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. Click(), Click(ratioX=0.5, ratioY=0.5): click center. Click(10, 10): click left+10, top+10. Click(-10, -10): click right-10, bottom-10.
uiautomation/uiautomation.py
def Click(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None: """ x: int, if < 0, click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. Click(), Click(ratioX=0.5, ratioY=0.5): click center. Click(10, 10): click left+10, top+10. Click(-10, -10): click right-10, bottom-10. """ point = self.MoveCursorToInnerPos(x, y, ratioX, ratioY, simulateMove) if point: Click(point[0], point[1], waitTime)
def Click(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None: """ x: int, if < 0, click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. Click(), Click(ratioX=0.5, ratioY=0.5): click center. Click(10, 10): click left+10, top+10. Click(-10, -10): click right-10, bottom-10. """ point = self.MoveCursorToInnerPos(x, y, ratioX, ratioY, simulateMove) if point: Click(point[0], point[1], waitTime)
[ "x", ":", "int", "if", "<", "0", "click", "self", ".", "BoundingRectangle", ".", "right", "+", "x", "if", "not", "None", "ignore", "ratioX", ".", "y", ":", "int", "if", "<", "0", "click", "self", ".", "BoundingRectangle", ".", "bottom", "+", "y", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5944-L5959
[ "def", "Click", "(", "self", ",", "x", ":", "int", "=", "None", ",", "y", ":", "int", "=", "None", ",", "ratioX", ":", "float", "=", "0.5", ",", "ratioY", ":", "float", "=", "0.5", ",", "simulateMove", ":", "bool", "=", "True", ",", "waitTime", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.DoubleClick
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. DoubleClick(), DoubleClick(ratioX=0.5, ratioY=0.5): double click center. DoubleClick(10, 10): double click left+10, top+10. DoubleClick(-10, -10): double click right-10, bottom-10.
uiautomation/uiautomation.py
def DoubleClick(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None: """ x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. DoubleClick(), DoubleClick(ratioX=0.5, ratioY=0.5): double click center. DoubleClick(10, 10): double click left+10, top+10. DoubleClick(-10, -10): double click right-10, bottom-10. """ x, y = self.MoveCursorToInnerPos(x, y, ratioX, ratioY, simulateMove) Click(x, y, GetDoubleClickTime() * 1.0 / 2000) Click(x, y, waitTime)
def DoubleClick(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> None: """ x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. DoubleClick(), DoubleClick(ratioX=0.5, ratioY=0.5): double click center. DoubleClick(10, 10): double click left+10, top+10. DoubleClick(-10, -10): double click right-10, bottom-10. """ x, y = self.MoveCursorToInnerPos(x, y, ratioX, ratioY, simulateMove) Click(x, y, GetDoubleClickTime() * 1.0 / 2000) Click(x, y, waitTime)
[ "x", ":", "int", "if", "<", "0", "right", "click", "self", ".", "BoundingRectangle", ".", "right", "+", "x", "if", "not", "None", "ignore", "ratioX", ".", "y", ":", "int", "if", "<", "0", "right", "click", "self", ".", "BoundingRectangle", ".", "bott...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L5995-L6010
[ "def", "DoubleClick", "(", "self", ",", "x", ":", "int", "=", "None", ",", "y", ":", "int", "=", "None", ",", "ratioX", ":", "float", "=", "0.5", ",", "ratioY", ":", "float", "=", "0.5", ",", "simulateMove", ":", "bool", "=", "True", ",", "waitTi...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.WheelDown
Make control have focus first, move cursor to center and mouse wheel down. wheelTimes: int. interval: float. waitTime: float.
uiautomation/uiautomation.py
def WheelDown(self, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Make control have focus first, move cursor to center and mouse wheel down. wheelTimes: int. interval: float. waitTime: float. """ x, y = GetCursorPos() self.SetFocus() self.MoveCursorToMyCenter(False) WheelDown(wheelTimes, interval, waitTime) SetCursorPos(x, y)
def WheelDown(self, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Make control have focus first, move cursor to center and mouse wheel down. wheelTimes: int. interval: float. waitTime: float. """ x, y = GetCursorPos() self.SetFocus() self.MoveCursorToMyCenter(False) WheelDown(wheelTimes, interval, waitTime) SetCursorPos(x, y)
[ "Make", "control", "have", "focus", "first", "move", "cursor", "to", "center", "and", "mouse", "wheel", "down", ".", "wheelTimes", ":", "int", ".", "interval", ":", "float", ".", "waitTime", ":", "float", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6012-L6023
[ "def", "WheelDown", "(", "self", ",", "wheelTimes", ":", "int", "=", "1", ",", "interval", ":", "float", "=", "0.05", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "None", ":", "x", ",", "y", "=", "GetCursorPos", "(", ")", "se...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.ShowWindow
Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow. cmdShow: int, a value in in class `SW`. waitTime: float. Return bool, True if succeed otherwise False.
uiautomation/uiautomation.py
def ShowWindow(self, cmdShow: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow. cmdShow: int, a value in in class `SW`. waitTime: float. Return bool, True if succeed otherwise False. """ handle = self.NativeWindowHandle if not handle: control = self while not handle: control = control.GetParentControl() handle = control.NativeWindowHandle if handle: ret = ShowWindow(handle, cmdShow) time.sleep(waitTime) return ret
def ShowWindow(self, cmdShow: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow. cmdShow: int, a value in in class `SW`. waitTime: float. Return bool, True if succeed otherwise False. """ handle = self.NativeWindowHandle if not handle: control = self while not handle: control = control.GetParentControl() handle = control.NativeWindowHandle if handle: ret = ShowWindow(handle, cmdShow) time.sleep(waitTime) return ret
[ "Get", "a", "native", "handle", "from", "self", "or", "ancestors", "until", "valid", "and", "call", "native", "ShowWindow", "with", "cmdShow", ".", "cmdShow", ":", "int", "a", "value", "in", "in", "class", "SW", ".", "waitTime", ":", "float", ".", "Retur...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6038-L6054
[ "def", "ShowWindow", "(", "self", ",", "cmdShow", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "not", "handle", ":", "control", "=", "self", "while", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Show
Call native `ShowWindow(SW.Show)`. Return bool, True if succeed otherwise False.
uiautomation/uiautomation.py
def Show(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call native `ShowWindow(SW.Show)`. Return bool, True if succeed otherwise False. """ return self.ShowWindow(SW.Show, waitTime)
def Show(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call native `ShowWindow(SW.Show)`. Return bool, True if succeed otherwise False. """ return self.ShowWindow(SW.Show, waitTime)
[ "Call", "native", "ShowWindow", "(", "SW", ".", "Show", ")", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6056-L6061
[ "def", "Show", "(", "self", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "return", "self", ".", "ShowWindow", "(", "SW", ".", "Show", ",", "waitTime", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.Hide
Call native `ShowWindow(SW.Hide)`. waitTime: float Return bool, True if succeed otherwise False.
uiautomation/uiautomation.py
def Hide(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call native `ShowWindow(SW.Hide)`. waitTime: float Return bool, True if succeed otherwise False. """ return self.ShowWindow(SW.Hide, waitTime)
def Hide(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call native `ShowWindow(SW.Hide)`. waitTime: float Return bool, True if succeed otherwise False. """ return self.ShowWindow(SW.Hide, waitTime)
[ "Call", "native", "ShowWindow", "(", "SW", ".", "Hide", ")", ".", "waitTime", ":", "float", "Return", "bool", "True", "if", "succeed", "otherwise", "False", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6063-L6069
[ "def", "Hide", "(", "self", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "return", "self", ".", "ShowWindow", "(", "SW", ".", "Hide", ",", "waitTime", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.MoveWindow
Call native MoveWindow if control has a valid native handle. x: int. y: int. width: int. height: int. repaint: bool. Return bool, True if succeed otherwise False.
uiautomation/uiautomation.py
def MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool: """ Call native MoveWindow if control has a valid native handle. x: int. y: int. width: int. height: int. repaint: bool. Return bool, True if succeed otherwise False. """ handle = self.NativeWindowHandle if handle: return MoveWindow(handle, x, y, width, height, int(repaint)) return False
def MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool: """ Call native MoveWindow if control has a valid native handle. x: int. y: int. width: int. height: int. repaint: bool. Return bool, True if succeed otherwise False. """ handle = self.NativeWindowHandle if handle: return MoveWindow(handle, x, y, width, height, int(repaint)) return False
[ "Call", "native", "MoveWindow", "if", "control", "has", "a", "valid", "native", "handle", ".", "x", ":", "int", ".", "y", ":", "int", ".", "width", ":", "int", ".", "height", ":", "int", ".", "repaint", ":", "bool", ".", "Return", "bool", "True", "...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6071-L6084
[ "def", "MoveWindow", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ",", "repaint", ":", "bool", "=", "True", ")", "->", "bool", ":", "handle", "=", "self", ".", "NativeWindowHandle", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.SetWindowText
Call native SetWindowText if control has a valid native handle.
uiautomation/uiautomation.py
def SetWindowText(self, text: str) -> bool: """ Call native SetWindowText if control has a valid native handle. """ handle = self.NativeWindowHandle if handle: return SetWindowText(handle, text) return False
def SetWindowText(self, text: str) -> bool: """ Call native SetWindowText if control has a valid native handle. """ handle = self.NativeWindowHandle if handle: return SetWindowText(handle, text) return False
[ "Call", "native", "SetWindowText", "if", "control", "has", "a", "valid", "native", "handle", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6094-L6101
[ "def", "SetWindowText", "(", "self", ",", "text", ":", "str", ")", "->", "bool", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "handle", ":", "return", "SetWindowText", "(", "handle", ",", "text", ")", "return", "False" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.SendKey
Make control have focus first and type a key. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. key: int, a key code value in class Keys. waitTime: float.
uiautomation/uiautomation.py
def SendKey(self, key: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Make control have focus first and type a key. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. key: int, a key code value in class Keys. waitTime: float. """ self.SetFocus() SendKey(key, waitTime)
def SendKey(self, key: int, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Make control have focus first and type a key. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. key: int, a key code value in class Keys. waitTime: float. """ self.SetFocus() SendKey(key, waitTime)
[ "Make", "control", "have", "focus", "first", "and", "type", "a", "key", ".", "self", ".", "SetFocus", "may", "not", "work", "for", "some", "controls", "you", "may", "need", "to", "click", "it", "to", "make", "it", "have", "focus", ".", "key", ":", "i...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6103-L6111
[ "def", "SendKey", "(", "self", ",", "key", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "None", ":", "self", ".", "SetFocus", "(", ")", "SendKey", "(", "key", ",", "waitTime", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.SendKeys
Make control have focus first and type keys. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. keys: str, keys to type, see the docstring of `SendKeys`. interval: float, seconds between keys.
uiautomation/uiautomation.py
def SendKeys(self, keys: str, interval: float = 0.01, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Make control have focus first and type keys. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. keys: str, keys to type, see the docstring of `SendKeys`. interval: float, seconds between keys. """ self.SetFocus() SendKeys(keys, interval, waitTime)
def SendKeys(self, keys: str, interval: float = 0.01, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Make control have focus first and type keys. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. keys: str, keys to type, see the docstring of `SendKeys`. interval: float, seconds between keys. """ self.SetFocus() SendKeys(keys, interval, waitTime)
[ "Make", "control", "have", "focus", "first", "and", "type", "keys", ".", "self", ".", "SetFocus", "may", "not", "work", "for", "some", "controls", "you", "may", "need", "to", "click", "it", "to", "make", "it", "have", "focus", ".", "keys", ":", "str", ...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6113-L6121
[ "def", "SendKeys", "(", "self", ",", "keys", ":", "str", ",", "interval", ":", "float", "=", "0.01", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "None", ":", "self", ".", "SetFocus", "(", ")", "SendKeys", "(", "keys", ",", "...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetPixelColor
Call native `GetPixelColor` if control has a valid native handle. Use `self.ToBitmap` if control doesn't have a valid native handle or you get many pixels. x: int, internal x position. y: int, internal y position. Return int, a color value in bgr. r = bgr & 0x0000FF g = (bgr & 0x00FF00) >> 8 b = (bgr & 0xFF0000) >> 16
uiautomation/uiautomation.py
def GetPixelColor(self, x: int, y: int) -> int: """ Call native `GetPixelColor` if control has a valid native handle. Use `self.ToBitmap` if control doesn't have a valid native handle or you get many pixels. x: int, internal x position. y: int, internal y position. Return int, a color value in bgr. r = bgr & 0x0000FF g = (bgr & 0x00FF00) >> 8 b = (bgr & 0xFF0000) >> 16 """ handle = self.NativeWindowHandle if handle: return GetPixelColor(x, y, handle)
def GetPixelColor(self, x: int, y: int) -> int: """ Call native `GetPixelColor` if control has a valid native handle. Use `self.ToBitmap` if control doesn't have a valid native handle or you get many pixels. x: int, internal x position. y: int, internal y position. Return int, a color value in bgr. r = bgr & 0x0000FF g = (bgr & 0x00FF00) >> 8 b = (bgr & 0xFF0000) >> 16 """ handle = self.NativeWindowHandle if handle: return GetPixelColor(x, y, handle)
[ "Call", "native", "GetPixelColor", "if", "control", "has", "a", "valid", "native", "handle", ".", "Use", "self", ".", "ToBitmap", "if", "control", "doesn", "t", "have", "a", "valid", "native", "handle", "or", "you", "get", "many", "pixels", ".", "x", ":"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6123-L6136
[ "def", "GetPixelColor", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "int", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "handle", ":", "return", "GetPixelColor", "(", "x", ",", "y", ",", "handle", ")" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.ToBitmap
Capture control to a Bitmap object. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height).
uiautomation/uiautomation.py
def ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Bitmap: """ Capture control to a Bitmap object. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height). """ bitmap = Bitmap() bitmap.FromControl(self, x, y, width, height) return bitmap
def ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Bitmap: """ Capture control to a Bitmap object. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height). """ bitmap = Bitmap() bitmap.FromControl(self, x, y, width, height) return bitmap
[ "Capture", "control", "to", "a", "Bitmap", "object", ".", "x", "y", ":", "int", "the", "point", "in", "control", "s", "internal", "position", "(", "from", "0", "0", ")", ".", "width", "height", ":", "int", "image", "s", "width", "and", "height", "fro...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6138-L6147
[ "def", "ToBitmap", "(", "self", ",", "x", ":", "int", "=", "0", ",", "y", ":", "int", "=", "0", ",", "width", ":", "int", "=", "0", ",", "height", ":", "int", "=", "0", ")", "->", "Bitmap", ":", "bitmap", "=", "Bitmap", "(", ")", "bitmap", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.CaptureToImage
Capture control to a image file. savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height). Return bool, True if succeed otherwise False.
uiautomation/uiautomation.py
def CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool: """ Capture control to a image file. savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height). Return bool, True if succeed otherwise False. """ bitmap = Bitmap() if bitmap.FromControl(self, x, y, width, height): return bitmap.ToFile(savePath) return False
def CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool: """ Capture control to a image file. savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height). Return bool, True if succeed otherwise False. """ bitmap = Bitmap() if bitmap.FromControl(self, x, y, width, height): return bitmap.ToFile(savePath) return False
[ "Capture", "control", "to", "a", "image", "file", ".", "savePath", ":", "str", "should", "end", "with", ".", "bmp", ".", "jpg", ".", "jpeg", ".", "png", ".", "gif", ".", "tif", ".", "tiff", ".", "x", "y", ":", "int", "the", "point", "in", "contro...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6149-L6161
[ "def", "CaptureToImage", "(", "self", ",", "savePath", ":", "str", ",", "x", ":", "int", "=", "0", ",", "y", ":", "int", "=", "0", ",", "width", ":", "int", "=", "0", ",", "height", ":", "int", "=", "0", ")", "->", "bool", ":", "bitmap", "=",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.IsTopLevel
Determine whether current control is top level.
uiautomation/uiautomation.py
def IsTopLevel(self) -> bool: """Determine whether current control is top level.""" handle = self.NativeWindowHandle if handle: return GetAncestor(handle, GAFlag.Root) == handle return False
def IsTopLevel(self) -> bool: """Determine whether current control is top level.""" handle = self.NativeWindowHandle if handle: return GetAncestor(handle, GAFlag.Root) == handle return False
[ "Determine", "whether", "current", "control", "is", "top", "level", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6163-L6168
[ "def", "IsTopLevel", "(", "self", ")", "->", "bool", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "handle", ":", "return", "GetAncestor", "(", "handle", ",", "GAFlag", ".", "Root", ")", "==", "handle", "return", "False" ]
2cc91060982cc8b777152e698d677cc2989bf263
valid
Control.GetTopLevelControl
Get the top level control which current control lays. If current control is top level, return self. If current control is root control, return None. Return `PaneControl` or `WindowControl` or None.
uiautomation/uiautomation.py
def GetTopLevelControl(self) -> 'Control': """ Get the top level control which current control lays. If current control is top level, return self. If current control is root control, return None. Return `PaneControl` or `WindowControl` or None. """ handle = self.NativeWindowHandle if handle: topHandle = GetAncestor(handle, GAFlag.Root) if topHandle: if topHandle == handle: return self else: return ControlFromHandle(topHandle) else: #self is root control pass else: control = self while True: control = control.GetParentControl() handle = control.NativeWindowHandle if handle: topHandle = GetAncestor(handle, GAFlag.Root) return ControlFromHandle(topHandle)
def GetTopLevelControl(self) -> 'Control': """ Get the top level control which current control lays. If current control is top level, return self. If current control is root control, return None. Return `PaneControl` or `WindowControl` or None. """ handle = self.NativeWindowHandle if handle: topHandle = GetAncestor(handle, GAFlag.Root) if topHandle: if topHandle == handle: return self else: return ControlFromHandle(topHandle) else: #self is root control pass else: control = self while True: control = control.GetParentControl() handle = control.NativeWindowHandle if handle: topHandle = GetAncestor(handle, GAFlag.Root) return ControlFromHandle(topHandle)
[ "Get", "the", "top", "level", "control", "which", "current", "control", "lays", ".", "If", "current", "control", "is", "top", "level", "return", "self", ".", "If", "current", "control", "is", "root", "control", "return", "None", ".", "Return", "PaneControl",...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6170-L6195
[ "def", "GetTopLevelControl", "(", "self", ")", "->", "'Control'", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "handle", ":", "topHandle", "=", "GetAncestor", "(", "handle", ",", "GAFlag", ".", "Root", ")", "if", "topHandle", ":", "if", "to...
2cc91060982cc8b777152e698d677cc2989bf263
valid
ComboBoxControl.Select
Show combobox's popup menu and select a item by name. itemName: str. condition: Callable function(comboBoxItemName: str)->bool, if condition is valid, ignore itemName. waitTime: float. Some comboboxs doesn't support SelectionPattern, here is a workaround. This method tries to and selection support. It may not work for some comboboxes, such as comboboxes in older Qt version. If it doesn't work, you should write your own version Select, or it doesn't support selection at all.
uiautomation/uiautomation.py
def Select(self, itemName: str = '', condition: Callable = None, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Show combobox's popup menu and select a item by name. itemName: str. condition: Callable function(comboBoxItemName: str)->bool, if condition is valid, ignore itemName. waitTime: float. Some comboboxs doesn't support SelectionPattern, here is a workaround. This method tries to and selection support. It may not work for some comboboxes, such as comboboxes in older Qt version. If it doesn't work, you should write your own version Select, or it doesn't support selection at all. """ expandCollapsePattern = self.GetExpandCollapsePattern() if expandCollapsePattern: expandCollapsePattern.Expand() else: #Windows Form's ComboBoxControl doesn't support ExpandCollapsePattern self.Click(x=-10, ratioY=0.5, simulateMove=False) find = False if condition: listItemControl = self.ListItemControl(Compare=lambda c, d: condition(c.Name)) else: listItemControl = self.ListItemControl(Name=itemName) if listItemControl.Exists(1): scrollItemPattern = listItemControl.GetScrollItemPattern() if scrollItemPattern: scrollItemPattern.ScrollIntoView(waitTime=0.1) listItemControl.Click(waitTime=waitTime) find = True else: #ComboBox's popup window is a child of root control listControl = ListControl(searchDepth= 1) if listControl.Exists(1): if condition: listItemControl = self.ListItemControl(Compare=lambda c, d: condition(c.Name)) else: listItemControl = self.ListItemControl(Name=itemName) if listItemControl.Exists(0, 0): scrollItemPattern = listItemControl.GetScrollItemPattern() if scrollItemPattern: scrollItemPattern.ScrollIntoView(waitTime=0.1) listItemControl.Click(waitTime=waitTime) find = True if not find: Logger.ColorfullyWriteLine('Can\'t find <Color=Cyan>{}</Color> in ComboBoxControl or it does not support selection.'.format(itemName), ConsoleColor.Yellow) if expandCollapsePattern: expandCollapsePattern.Collapse(waitTime) else: self.Click(x=-10, ratioY=0.5, simulateMove=False, waitTime=waitTime) return find
def Select(self, itemName: str = '', condition: Callable = None, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Show combobox's popup menu and select a item by name. itemName: str. condition: Callable function(comboBoxItemName: str)->bool, if condition is valid, ignore itemName. waitTime: float. Some comboboxs doesn't support SelectionPattern, here is a workaround. This method tries to and selection support. It may not work for some comboboxes, such as comboboxes in older Qt version. If it doesn't work, you should write your own version Select, or it doesn't support selection at all. """ expandCollapsePattern = self.GetExpandCollapsePattern() if expandCollapsePattern: expandCollapsePattern.Expand() else: #Windows Form's ComboBoxControl doesn't support ExpandCollapsePattern self.Click(x=-10, ratioY=0.5, simulateMove=False) find = False if condition: listItemControl = self.ListItemControl(Compare=lambda c, d: condition(c.Name)) else: listItemControl = self.ListItemControl(Name=itemName) if listItemControl.Exists(1): scrollItemPattern = listItemControl.GetScrollItemPattern() if scrollItemPattern: scrollItemPattern.ScrollIntoView(waitTime=0.1) listItemControl.Click(waitTime=waitTime) find = True else: #ComboBox's popup window is a child of root control listControl = ListControl(searchDepth= 1) if listControl.Exists(1): if condition: listItemControl = self.ListItemControl(Compare=lambda c, d: condition(c.Name)) else: listItemControl = self.ListItemControl(Name=itemName) if listItemControl.Exists(0, 0): scrollItemPattern = listItemControl.GetScrollItemPattern() if scrollItemPattern: scrollItemPattern.ScrollIntoView(waitTime=0.1) listItemControl.Click(waitTime=waitTime) find = True if not find: Logger.ColorfullyWriteLine('Can\'t find <Color=Cyan>{}</Color> in ComboBoxControl or it does not support selection.'.format(itemName), ConsoleColor.Yellow) if expandCollapsePattern: expandCollapsePattern.Collapse(waitTime) else: self.Click(x=-10, ratioY=0.5, simulateMove=False, waitTime=waitTime) return find
[ "Show", "combobox", "s", "popup", "menu", "and", "select", "a", "item", "by", "name", ".", "itemName", ":", "str", ".", "condition", ":", "Callable", "function", "(", "comboBoxItemName", ":", "str", ")", "-", ">", "bool", "if", "condition", "is", "valid"...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6416-L6464
[ "def", "Select", "(", "self", ",", "itemName", ":", "str", "=", "''", ",", "condition", ":", "Callable", "=", "None", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "expandCollapsePattern", "=", "self", ".", "GetExpandCo...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TopLevel.SetTopmost
Set top level window topmost. isTopmost: bool. waitTime: float.
uiautomation/uiautomation.py
def SetTopmost(self, isTopmost: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Set top level window topmost. isTopmost: bool. waitTime: float. """ if self.IsTopLevel(): ret = SetWindowTopmost(self.NativeWindowHandle, isTopmost) time.sleep(waitTime) return ret return False
def SetTopmost(self, isTopmost: bool = True, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Set top level window topmost. isTopmost: bool. waitTime: float. """ if self.IsTopLevel(): ret = SetWindowTopmost(self.NativeWindowHandle, isTopmost) time.sleep(waitTime) return ret return False
[ "Set", "top", "level", "window", "topmost", ".", "isTopmost", ":", "bool", ".", "waitTime", ":", "float", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6817-L6827
[ "def", "SetTopmost", "(", "self", ",", "isTopmost", ":", "bool", "=", "True", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "if", "self", ".", "IsTopLevel", "(", ")", ":", "ret", "=", "SetWindowTopmost", "(", "self", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TopLevel.Maximize
Set top level window maximize.
uiautomation/uiautomation.py
def Maximize(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Set top level window maximize. """ if self.IsTopLevel(): return self.ShowWindow(SW.ShowMaximized, waitTime) return False
def Maximize(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Set top level window maximize. """ if self.IsTopLevel(): return self.ShowWindow(SW.ShowMaximized, waitTime) return False
[ "Set", "top", "level", "window", "maximize", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6840-L6846
[ "def", "Maximize", "(", "self", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "if", "self", ".", "IsTopLevel", "(", ")", ":", "return", "self", ".", "ShowWindow", "(", "SW", ".", "ShowMaximized", ",", "waitTime", ")",...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TopLevel.MoveToCenter
Move window to screen center.
uiautomation/uiautomation.py
def MoveToCenter(self) -> bool: """ Move window to screen center. """ if self.IsTopLevel(): rect = self.BoundingRectangle screenWidth, screenHeight = GetScreenSize() x, y = (screenWidth - rect.width()) // 2, (screenHeight - rect.height()) // 2 if x < 0: x = 0 if y < 0: y = 0 return SetWindowPos(self.NativeWindowHandle, SWP.HWND_Top, x, y, 0, 0, SWP.SWP_NoSize) return False
def MoveToCenter(self) -> bool: """ Move window to screen center. """ if self.IsTopLevel(): rect = self.BoundingRectangle screenWidth, screenHeight = GetScreenSize() x, y = (screenWidth - rect.width()) // 2, (screenHeight - rect.height()) // 2 if x < 0: x = 0 if y < 0: y = 0 return SetWindowPos(self.NativeWindowHandle, SWP.HWND_Top, x, y, 0, 0, SWP.SWP_NoSize) return False
[ "Move", "window", "to", "screen", "center", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6872-L6883
[ "def", "MoveToCenter", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "IsTopLevel", "(", ")", ":", "rect", "=", "self", ".", "BoundingRectangle", "screenWidth", ",", "screenHeight", "=", "GetScreenSize", "(", ")", "x", ",", "y", "=", "(", "scr...
2cc91060982cc8b777152e698d677cc2989bf263
valid
TopLevel.SetActive
Set top level window active.
uiautomation/uiautomation.py
def SetActive(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """Set top level window active.""" if self.IsTopLevel(): handle = self.NativeWindowHandle if IsIconic(handle): ret = ShowWindow(handle, SW.Restore) elif not IsWindowVisible(handle): ret = ShowWindow(handle, SW.Show) ret = SetForegroundWindow(handle) # may fail if foreground windows's process is not python time.sleep(waitTime) return ret return False
def SetActive(self, waitTime: float = OPERATION_WAIT_TIME) -> bool: """Set top level window active.""" if self.IsTopLevel(): handle = self.NativeWindowHandle if IsIconic(handle): ret = ShowWindow(handle, SW.Restore) elif not IsWindowVisible(handle): ret = ShowWindow(handle, SW.Show) ret = SetForegroundWindow(handle) # may fail if foreground windows's process is not python time.sleep(waitTime) return ret return False
[ "Set", "top", "level", "window", "active", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L6885-L6896
[ "def", "SetActive", "(", "self", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "if", "self", ".", "IsTopLevel", "(", ")", ":", "handle", "=", "self", ".", "NativeWindowHandle", "if", "IsIconic", "(", "handle", ")", ":...
2cc91060982cc8b777152e698d677cc2989bf263
valid
WindowControl.MetroClose
Only work on Windows 8/8.1, if current window is Metro UI. waitTime: float.
uiautomation/uiautomation.py
def MetroClose(self, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Only work on Windows 8/8.1, if current window is Metro UI. waitTime: float. """ if self.ClassName == METRO_WINDOW_CLASS_NAME: screenWidth, screenHeight = GetScreenSize() MoveTo(screenWidth // 2, 0, waitTime=0) DragDrop(screenWidth // 2, 0, screenWidth // 2, screenHeight, waitTime=waitTime) else: Logger.WriteLine('Window is not Metro!', ConsoleColor.Yellow)
def MetroClose(self, waitTime: float = OPERATION_WAIT_TIME) -> None: """ Only work on Windows 8/8.1, if current window is Metro UI. waitTime: float. """ if self.ClassName == METRO_WINDOW_CLASS_NAME: screenWidth, screenHeight = GetScreenSize() MoveTo(screenWidth // 2, 0, waitTime=0) DragDrop(screenWidth // 2, 0, screenWidth // 2, screenHeight, waitTime=waitTime) else: Logger.WriteLine('Window is not Metro!', ConsoleColor.Yellow)
[ "Only", "work", "on", "Windows", "8", "/", "8", ".", "1", "if", "current", "window", "is", "Metro", "UI", ".", "waitTime", ":", "float", "." ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L7278-L7288
[ "def", "MetroClose", "(", "self", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "None", ":", "if", "self", ".", "ClassName", "==", "METRO_WINDOW_CLASS_NAME", ":", "screenWidth", ",", "screenHeight", "=", "GetScreenSize", "(", ")", "Move...
2cc91060982cc8b777152e698d677cc2989bf263
valid
DemoCN
for Chinese language
demos/automation_help_demo.py
def DemoCN(): """for Chinese language""" thisWindow = auto.GetConsoleWindow() auto.Logger.ColorfullyWrite('我将运行<Color=Cyan>cmd</Color>并设置它的<Color=Cyan>屏幕缓冲区</Color>使<Color=Cyan>cmd</Color>一行能容纳很多字符\n\n') time.sleep(3) auto.SendKeys('{Win}r') while not isinstance(auto.GetFocusedControl(), auto.EditControl): time.sleep(1) auto.SendKeys('cmd{Enter}') cmdWindow = auto.WindowControl(RegexName = '.+cmd.exe') cmdWindow.TitleBarControl().RightClick() auto.SendKey(auto.Keys.VK_P) optionWindow = cmdWindow.WindowControl(SubName = '属性') optionWindow.TabItemControl(SubName = '选项').Click() optionTab = optionWindow.PaneControl(SubName = '选项') checkBox = optionTab.CheckBoxControl(AutomationId = '103') if checkBox.GetTogglePattern().ToggleState != auto.ToggleState.On: checkBox.Click() checkBox = optionTab.CheckBoxControl(AutomationId = '104') if checkBox.GetTogglePattern().ToggleState != auto.ToggleState.On: checkBox.Click() optionWindow.TabItemControl(SubName = '布局').Click() layoutTab = optionWindow.PaneControl(SubName = '布局') layoutTab.EditControl(AutomationId='301').GetValuePattern().SetValue('300') layoutTab.EditControl(AutomationId='303').GetValuePattern().SetValue('3000') layoutTab.EditControl(AutomationId='305').GetValuePattern().SetValue('140') layoutTab.EditControl(AutomationId='307').GetValuePattern().SetValue('30') optionWindow.ButtonControl(AutomationId = '1').Click() cmdWindow.SetActive() rect = cmdWindow.BoundingRectangle auto.DragDrop(rect.left + 50, rect.top + 10, 50, 30) thisWindow.SetActive() auto.Logger.ColorfullyWrite('我将运行<Color=Cyan>记事本</Color>并输入<Color=Cyan>Hello!!!</Color>\n\n') time.sleep(3) subprocess.Popen('notepad') notepadWindow = auto.WindowControl(searchDepth = 1, ClassName = 'Notepad') cx, cy = auto.GetScreenSize() notepadWindow.MoveWindow(cx // 2, 20, cx // 2, cy // 2) time.sleep(0.5) notepadWindow.EditControl().SendKeys('Hello!!!', 0.05) time.sleep(1) dir = os.path.dirname(__file__) scriptPath = os.path.abspath(os.path.join(dir, '..\\automation.py')) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -h</Color>"显示帮助\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -h'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -r -d1</Color>"显示所有顶层窗口, 即桌面的子窗口\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -r -d1 -t0'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -c</Color>"显示鼠标光标下的控件\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -c -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -a</Color>"显示鼠标光标下的控件和它的所有父控件\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -a -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py</Color>"显示当前激活窗口和它的所有子控件\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.EditControl().Click() time.sleep(3) cmdWindow.SetActive(waitTime = 2) time.sleep(3) thisWindow.SetActive() auto.Logger.WriteLine('演示结束,按Enter退出', auto.ConsoleColor.Green) input()
def DemoCN(): """for Chinese language""" thisWindow = auto.GetConsoleWindow() auto.Logger.ColorfullyWrite('我将运行<Color=Cyan>cmd</Color>并设置它的<Color=Cyan>屏幕缓冲区</Color>使<Color=Cyan>cmd</Color>一行能容纳很多字符\n\n') time.sleep(3) auto.SendKeys('{Win}r') while not isinstance(auto.GetFocusedControl(), auto.EditControl): time.sleep(1) auto.SendKeys('cmd{Enter}') cmdWindow = auto.WindowControl(RegexName = '.+cmd.exe') cmdWindow.TitleBarControl().RightClick() auto.SendKey(auto.Keys.VK_P) optionWindow = cmdWindow.WindowControl(SubName = '属性') optionWindow.TabItemControl(SubName = '选项').Click() optionTab = optionWindow.PaneControl(SubName = '选项') checkBox = optionTab.CheckBoxControl(AutomationId = '103') if checkBox.GetTogglePattern().ToggleState != auto.ToggleState.On: checkBox.Click() checkBox = optionTab.CheckBoxControl(AutomationId = '104') if checkBox.GetTogglePattern().ToggleState != auto.ToggleState.On: checkBox.Click() optionWindow.TabItemControl(SubName = '布局').Click() layoutTab = optionWindow.PaneControl(SubName = '布局') layoutTab.EditControl(AutomationId='301').GetValuePattern().SetValue('300') layoutTab.EditControl(AutomationId='303').GetValuePattern().SetValue('3000') layoutTab.EditControl(AutomationId='305').GetValuePattern().SetValue('140') layoutTab.EditControl(AutomationId='307').GetValuePattern().SetValue('30') optionWindow.ButtonControl(AutomationId = '1').Click() cmdWindow.SetActive() rect = cmdWindow.BoundingRectangle auto.DragDrop(rect.left + 50, rect.top + 10, 50, 30) thisWindow.SetActive() auto.Logger.ColorfullyWrite('我将运行<Color=Cyan>记事本</Color>并输入<Color=Cyan>Hello!!!</Color>\n\n') time.sleep(3) subprocess.Popen('notepad') notepadWindow = auto.WindowControl(searchDepth = 1, ClassName = 'Notepad') cx, cy = auto.GetScreenSize() notepadWindow.MoveWindow(cx // 2, 20, cx // 2, cy // 2) time.sleep(0.5) notepadWindow.EditControl().SendKeys('Hello!!!', 0.05) time.sleep(1) dir = os.path.dirname(__file__) scriptPath = os.path.abspath(os.path.join(dir, '..\\automation.py')) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -h</Color>"显示帮助\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -h'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -r -d1</Color>"显示所有顶层窗口, 即桌面的子窗口\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -r -d1 -t0'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -c</Color>"显示鼠标光标下的控件\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -c -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py -a</Color>"显示鼠标光标下的控件和它的所有父控件\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -a -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('运行"<Color=Cyan>automation.py</Color>"显示当前激活窗口和它的所有子控件\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.EditControl().Click() time.sleep(3) cmdWindow.SetActive(waitTime = 2) time.sleep(3) thisWindow.SetActive() auto.Logger.WriteLine('演示结束,按Enter退出', auto.ConsoleColor.Green) input()
[ "for", "Chinese", "language" ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/demos/automation_help_demo.py#L13-L108
[ "def", "DemoCN", "(", ")", ":", "thisWindow", "=", "auto", ".", "GetConsoleWindow", "(", ")", "auto", ".", "Logger", ".", "ColorfullyWrite", "(", "'我将运行<Color=Cyan>cmd</Color>并设置它的<Color=Cyan>屏幕缓冲区</Color>使<Color=Cyan>cmd</Color>一行能容纳很多字符\\n\\n')", "", "time", ".", "sleep...
2cc91060982cc8b777152e698d677cc2989bf263
valid
DemoEN
for other language
demos/automation_help_demo.py
def DemoEN(): """for other language""" thisWindow = auto.GetConsoleWindow() auto.Logger.ColorfullyWrite('I will run <Color=Cyan>cmd</Color>\n\n') time.sleep(3) auto.SendKeys('{Win}r') while not isinstance(auto.GetFocusedControl(), auto.EditControl): time.sleep(1) auto.SendKeys('cmd{Enter}') cmdWindow = auto.WindowControl(SubName = 'cmd.exe') rect = cmdWindow.BoundingRectangle auto.DragDrop(rect.left + 50, rect.top + 10, 50, 10) thisWindow.SetActive() auto.Logger.ColorfullyWrite('I will run <Color=Cyan>Notepad</Color> and type <Color=Cyan>Hello!!!</Color>\n\n') time.sleep(3) subprocess.Popen('notepad') notepadWindow = auto.WindowControl(searchDepth = 1, ClassName = 'Notepad') cx, cy = auto.GetScreenSize() notepadWindow.MoveWindow(cx // 2, 20, cx // 2, cy // 2) time.sleep(0.5) notepadWindow.EditControl().SendKeys('Hello!!!', 0.05) time.sleep(1) dir = os.path.dirname(__file__) scriptPath = os.path.abspath(os.path.join(dir, '..\\automation.py')) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -h</Color>" to display the help\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -h'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -r -d1</Color>" to display the top level windows, desktop\'s children\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -r -d1 -t0'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -c</Color>" to display the control under mouse cursor\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -c -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -a</Color>" to display the control under mouse cursor and its ancestors\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -a -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py</Color>" to display the active window\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.EditControl().Click() time.sleep(3) cmdWindow.SetActive(waitTime = 2) time.sleep(3) thisWindow.SetActive() auto.Logger.WriteLine('press Enter to exit', auto.ConsoleColor.Green) input()
def DemoEN(): """for other language""" thisWindow = auto.GetConsoleWindow() auto.Logger.ColorfullyWrite('I will run <Color=Cyan>cmd</Color>\n\n') time.sleep(3) auto.SendKeys('{Win}r') while not isinstance(auto.GetFocusedControl(), auto.EditControl): time.sleep(1) auto.SendKeys('cmd{Enter}') cmdWindow = auto.WindowControl(SubName = 'cmd.exe') rect = cmdWindow.BoundingRectangle auto.DragDrop(rect.left + 50, rect.top + 10, 50, 10) thisWindow.SetActive() auto.Logger.ColorfullyWrite('I will run <Color=Cyan>Notepad</Color> and type <Color=Cyan>Hello!!!</Color>\n\n') time.sleep(3) subprocess.Popen('notepad') notepadWindow = auto.WindowControl(searchDepth = 1, ClassName = 'Notepad') cx, cy = auto.GetScreenSize() notepadWindow.MoveWindow(cx // 2, 20, cx // 2, cy // 2) time.sleep(0.5) notepadWindow.EditControl().SendKeys('Hello!!!', 0.05) time.sleep(1) dir = os.path.dirname(__file__) scriptPath = os.path.abspath(os.path.join(dir, '..\\automation.py')) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -h</Color>" to display the help\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -h'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -r -d1</Color>" to display the top level windows, desktop\'s children\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -r -d1 -t0'.format(scriptPath) + '{Enter}', 0.05) time.sleep(3) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -c</Color>" to display the control under mouse cursor\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -c -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py -a</Color>" to display the control under mouse cursor and its ancestors\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -a -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.MoveCursorToMyCenter() time.sleep(3) cmdWindow.SetActive(waitTime = 2) thisWindow.SetActive() auto.Logger.ColorfullyWrite('run "<Color=Cyan>automation.py</Color>" to display the active window\n\n') time.sleep(3) cmdWindow.SendKeys('"{}" -t3'.format(scriptPath) + '{Enter}', 0.05) notepadWindow.SetActive() notepadWindow.EditControl().Click() time.sleep(3) cmdWindow.SetActive(waitTime = 2) time.sleep(3) thisWindow.SetActive() auto.Logger.WriteLine('press Enter to exit', auto.ConsoleColor.Green) input()
[ "for", "other", "language" ]
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/demos/automation_help_demo.py#L111-L187
[ "def", "DemoEN", "(", ")", ":", "thisWindow", "=", "auto", ".", "GetConsoleWindow", "(", ")", "auto", ".", "Logger", ".", "ColorfullyWrite", "(", "'I will run <Color=Cyan>cmd</Color>\\n\\n'", ")", "time", ".", "sleep", "(", "3", ")", "auto", ".", "SendKeys", ...
2cc91060982cc8b777152e698d677cc2989bf263
valid
threadFunc
If you want to use functionalities related to Controls and Patterns in a new thread. You must call InitializeUIAutomationInCurrentThread first in the thread and call UninitializeUIAutomationInCurrentThread when the thread exits. But you can't use use a Control or a Pattern created in a different thread. So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it.
demos/uiautomation_in_thread.py
def threadFunc(root): """ If you want to use functionalities related to Controls and Patterns in a new thread. You must call InitializeUIAutomationInCurrentThread first in the thread and call UninitializeUIAutomationInCurrentThread when the thread exits. But you can't use use a Control or a Pattern created in a different thread. So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it. """ #print(root)# you cannot use root because it is root control created in main thread th = threading.currentThread() auto.Logger.WriteLine('\nThis is running in a new thread. {} {}'.format(th.ident, th.name), auto.ConsoleColor.Cyan) time.sleep(2) auto.InitializeUIAutomationInCurrentThread() auto.GetConsoleWindow().CaptureToImage('console_newthread.png') newRoot = auto.GetRootControl() #ok, root control created in new thread auto.EnumAndLogControl(newRoot, 1) auto.UninitializeUIAutomationInCurrentThread() auto.Logger.WriteLine('\nThread exits. {} {}'.format(th.ident, th.name), auto.ConsoleColor.Cyan)
def threadFunc(root): """ If you want to use functionalities related to Controls and Patterns in a new thread. You must call InitializeUIAutomationInCurrentThread first in the thread and call UninitializeUIAutomationInCurrentThread when the thread exits. But you can't use use a Control or a Pattern created in a different thread. So you can't create a Control or a Pattern in main thread and then pass it to a new thread and use it. """ #print(root)# you cannot use root because it is root control created in main thread th = threading.currentThread() auto.Logger.WriteLine('\nThis is running in a new thread. {} {}'.format(th.ident, th.name), auto.ConsoleColor.Cyan) time.sleep(2) auto.InitializeUIAutomationInCurrentThread() auto.GetConsoleWindow().CaptureToImage('console_newthread.png') newRoot = auto.GetRootControl() #ok, root control created in new thread auto.EnumAndLogControl(newRoot, 1) auto.UninitializeUIAutomationInCurrentThread() auto.Logger.WriteLine('\nThread exits. {} {}'.format(th.ident, th.name), auto.ConsoleColor.Cyan)
[ "If", "you", "want", "to", "use", "functionalities", "related", "to", "Controls", "and", "Patterns", "in", "a", "new", "thread", ".", "You", "must", "call", "InitializeUIAutomationInCurrentThread", "first", "in", "the", "thread", "and", "call", "UninitializeUIAuto...
yinkaisheng/Python-UIAutomation-for-Windows
python
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/demos/uiautomation_in_thread.py#L12-L29
[ "def", "threadFunc", "(", "root", ")", ":", "#print(root)# you cannot use root because it is root control created in main thread", "th", "=", "threading", ".", "currentThread", "(", ")", "auto", ".", "Logger", ".", "WriteLine", "(", "'\\nThis is running in a new thread. {} {}...
2cc91060982cc8b777152e698d677cc2989bf263
valid
SaliencyMapAttack._saliency_map
Implements Algorithm 3 in manuscript
foolbox/attacks/saliency.py
def _saliency_map(self, a, image, target, labels, mask, fast=False): """Implements Algorithm 3 in manuscript """ # pixel influence on target class alphas = a.gradient(image, target) * mask # pixel influence on sum of residual classes # (don't evaluate if fast == True) if fast: betas = -np.ones_like(alphas) else: betas = np.sum([ a.gradient(image, label) * mask - alphas for label in labels], 0) # compute saliency map # (take into account both pos. & neg. perturbations) salmap = np.abs(alphas) * np.abs(betas) * np.sign(alphas * betas) # find optimal pixel & direction of perturbation idx = np.argmin(salmap) idx = np.unravel_index(idx, mask.shape) pix_sign = np.sign(alphas)[idx] return idx, pix_sign
def _saliency_map(self, a, image, target, labels, mask, fast=False): """Implements Algorithm 3 in manuscript """ # pixel influence on target class alphas = a.gradient(image, target) * mask # pixel influence on sum of residual classes # (don't evaluate if fast == True) if fast: betas = -np.ones_like(alphas) else: betas = np.sum([ a.gradient(image, label) * mask - alphas for label in labels], 0) # compute saliency map # (take into account both pos. & neg. perturbations) salmap = np.abs(alphas) * np.abs(betas) * np.sign(alphas * betas) # find optimal pixel & direction of perturbation idx = np.argmin(salmap) idx = np.unravel_index(idx, mask.shape) pix_sign = np.sign(alphas)[idx] return idx, pix_sign
[ "Implements", "Algorithm", "3", "in", "manuscript" ]
bethgelab/foolbox
python
https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/saliency.py#L153-L179
[ "def", "_saliency_map", "(", "self", ",", "a", ",", "image", ",", "target", ",", "labels", ",", "mask", ",", "fast", "=", "False", ")", ":", "# pixel influence on target class", "alphas", "=", "a", ".", "gradient", "(", "image", ",", "target", ")", "*", ...
8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a
valid
TensorFlowModel.from_keras
Alternative constructor for a TensorFlowModel that accepts a `tf.keras.Model` instance. Parameters ---------- model : `tensorflow.keras.Model` A `tensorflow.keras.Model` that accepts a single input tensor and returns a single output tensor representing logits. bounds : tuple Tuple of lower and upper bound for the pixel values, usually (0, 1) or (0, 255). input_shape : tuple The shape of a single input, e.g. (28, 28, 1) for MNIST. If None, tries to get the the shape from the model's input_shape attribute. channel_axis : int The index of the axis that represents color channels. preprocessing: 2-element tuple with floats or numpy arrays Elementwises preprocessing of input; we first subtract the first element of preprocessing from the input and then divide the input by the second element.
foolbox/models/tensorflow.py
def from_keras(cls, model, bounds, input_shape=None, channel_axis=3, preprocessing=(0, 1)): """Alternative constructor for a TensorFlowModel that accepts a `tf.keras.Model` instance. Parameters ---------- model : `tensorflow.keras.Model` A `tensorflow.keras.Model` that accepts a single input tensor and returns a single output tensor representing logits. bounds : tuple Tuple of lower and upper bound for the pixel values, usually (0, 1) or (0, 255). input_shape : tuple The shape of a single input, e.g. (28, 28, 1) for MNIST. If None, tries to get the the shape from the model's input_shape attribute. channel_axis : int The index of the axis that represents color channels. preprocessing: 2-element tuple with floats or numpy arrays Elementwises preprocessing of input; we first subtract the first element of preprocessing from the input and then divide the input by the second element. """ import tensorflow as tf if input_shape is None: try: input_shape = model.input_shape[1:] except AttributeError: raise ValueError( 'Please specify input_shape manually or ' 'provide a model with an input_shape attribute') with tf.keras.backend.get_session().as_default(): inputs = tf.placeholder(tf.float32, (None,) + input_shape) logits = model(inputs) return cls(inputs, logits, bounds=bounds, channel_axis=channel_axis, preprocessing=preprocessing)
def from_keras(cls, model, bounds, input_shape=None, channel_axis=3, preprocessing=(0, 1)): """Alternative constructor for a TensorFlowModel that accepts a `tf.keras.Model` instance. Parameters ---------- model : `tensorflow.keras.Model` A `tensorflow.keras.Model` that accepts a single input tensor and returns a single output tensor representing logits. bounds : tuple Tuple of lower and upper bound for the pixel values, usually (0, 1) or (0, 255). input_shape : tuple The shape of a single input, e.g. (28, 28, 1) for MNIST. If None, tries to get the the shape from the model's input_shape attribute. channel_axis : int The index of the axis that represents color channels. preprocessing: 2-element tuple with floats or numpy arrays Elementwises preprocessing of input; we first subtract the first element of preprocessing from the input and then divide the input by the second element. """ import tensorflow as tf if input_shape is None: try: input_shape = model.input_shape[1:] except AttributeError: raise ValueError( 'Please specify input_shape manually or ' 'provide a model with an input_shape attribute') with tf.keras.backend.get_session().as_default(): inputs = tf.placeholder(tf.float32, (None,) + input_shape) logits = model(inputs) return cls(inputs, logits, bounds=bounds, channel_axis=channel_axis, preprocessing=preprocessing)
[ "Alternative", "constructor", "for", "a", "TensorFlowModel", "that", "accepts", "a", "tf", ".", "keras", ".", "Model", "instance", "." ]
bethgelab/foolbox
python
https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/models/tensorflow.py#L82-L119
[ "def", "from_keras", "(", "cls", ",", "model", ",", "bounds", ",", "input_shape", "=", "None", ",", "channel_axis", "=", "3", ",", "preprocessing", "=", "(", "0", ",", "1", ")", ")", ":", "import", "tensorflow", "as", "tf", "if", "input_shape", "is", ...
8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a