Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
control click
Browse files Browse the repository at this point in the history
  • Loading branch information
spyoungtech committed Nov 11, 2022
1 parent 2d0c47d commit f631b55
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
3 changes: 1 addition & 2 deletions ahk/_async/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ async def control_click(
detect_hidden_windows: Optional[bool] = None,
blocking: bool = True,
) -> Union[None, AsyncFutureResult[None]]:
raise NotImplementedError
args = [control, title, text, button, click_count, options, exclude_title, exclude_text]
args = [control, title, text, str(button), str(click_count), options, exclude_title, exclude_text]
if detect_hidden_windows is not None:
if detect_hidden_windows is True:
args.append('On')
Expand Down
10 changes: 9 additions & 1 deletion ahk/_async/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ async def click(self, *, button: Union[int, str] = 1, click_count: int = 1, opti
async def click(
self, *, button: Union[int, str] = 1, click_count: int = 1, options: str = '', blocking: bool = True
) -> Union[None, AsyncFutureResult[None]]:
raise NotImplementedError
return await self._engine.control_click(
button=button,
control=self.control_class,
options=options,
title=f'ahk_id {self.window._ahk_id}',
title_match_mode=(1, 'Fast'),
detect_hidden_windows=True,
blocking=blocking,
)

# fmt: off
@overload
Expand Down
3 changes: 1 addition & 2 deletions ahk/_sync/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ def control_click(
detect_hidden_windows: Optional[bool] = None,
blocking: bool = True,
) -> Union[None, FutureResult[None]]:
raise NotImplementedError
args = [control, title, text, button, click_count, options, exclude_title, exclude_text]
args = [control, title, text, str(button), str(click_count), options, exclude_title, exclude_text]
if detect_hidden_windows is not None:
if detect_hidden_windows is True:
args.append('On')
Expand Down
28 changes: 18 additions & 10 deletions ahk/_sync/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def get_text(self, *, blocking: bool = True) -> Union[str, FutureResult[str]]: .
# fmt: on
def get_text(self, *, blocking: bool = True) -> Union[str, FutureResult[str]]:
return self._engine.win_get_text(
title=f'ahk_id {self._ahk_id}', blocking=blocking, detect_hidden_windows=True, title_match_mode=(1, 'Fast')
)
title=f'ahk_id {self._ahk_id}', blocking=blocking, detect_hidden_windows=True, title_match_mode=(1, 'Fast')
)


class Control:
Expand All @@ -207,7 +207,15 @@ def click(self, *, button: Union[int, str] = 1, click_count: int = 1, options: s
def click(
self, *, button: Union[int, str] = 1, click_count: int = 1, options: str = '', blocking: bool = True
) -> Union[None, FutureResult[None]]:
raise NotImplementedError
return self._engine.control_click(
button=button,
control=self.control_class,
options=options,
title=f'ahk_id {self.window._ahk_id}',
title_match_mode=(1, 'Fast'),
detect_hidden_windows=True,
blocking=blocking
)

# fmt: off
@overload
Expand All @@ -221,13 +229,13 @@ def send(self, keys: str, *, blocking: bool = True) -> Union[None, FutureResult[
# fmt: on
def send(self, keys: str, *, blocking: bool = True) -> Union[None, FutureResult[None]]:
return self._engine.control_send(
keys=keys,
control=self.control_class,
title=f'ahk_id {self.window._ahk_id}',
blocking=blocking,
detect_hidden_windows=True,
title_match_mode=(1, 'Fast'),
)
keys=keys,
control=self.control_class,
title=f'ahk_id {self.window._ahk_id}',
blocking=blocking,
detect_hidden_windows=True,
title_match_mode=(1, 'Fast'),
)

def get_text(self, blocking: bool = True) -> Union[str, FutureResult[str]]:
return self._engine.control_get_text(
Expand Down

0 comments on commit f631b55

Please sign in to comment.