diff --git a/ahk/_async/engine.py b/ahk/_async/engine.py index 64b9b33..3e01a7b 100644 --- a/ahk/_async/engine.py +++ b/ahk/_async/engine.py @@ -3315,6 +3315,10 @@ async def win_wait( """ Analog for `WinWait `_ """ + if not title and not text and not exclude_title and not exclude_text: + raise ValueError( + 'Expected non-blank value for at least one of the following: title, text, exclude_title, exclude_text' + ) args = self._format_win_args( title=title, text=text, diff --git a/ahk/_constants.py b/ahk/_constants.py index c643eab..60f5a60 100644 --- a/ahk/_constants.py +++ b/ahk/_constants.py @@ -5354,7 +5354,7 @@ AHKControlClick(args*) { {% block AHKControlClick %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] title := args[2] text := args[3] button := args[4] @@ -5381,7 +5381,7 @@ } try { - ControlClick(ctrl, title, text, button, click_count, options, exclude_title, exclude_text) + ControlClick(ctrl || unset, title, text, button, click_count, options, exclude_title, exclude_text) } finally { DetectHiddenWindows(current_detect_hw) @@ -5396,7 +5396,7 @@ AHKControlGetText(args*) { {% block AHKControlGetText %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] title := args[2] text := args[3] extitle := args[4] @@ -5436,7 +5436,7 @@ AHKControlGetPos(args*) { {% block AHKControlGetPos %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] title := args[2] text := args[3] extitle := args[4] @@ -5475,7 +5475,7 @@ AHKControlSend(args*) { {% block AHKControlSend %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] keys := args[2] title := args[3] text := args[4] @@ -5500,11 +5500,7 @@ } try { - if (ctrl != "") { - ControlSend(keys, ctrl, title, text, extitle, extext) - } else { - ControlSend(keys,, title, text, extitle, extext) - } + ControlSend(keys, ctrl || unset, title, text, extitle, extext) } finally { DetectHiddenWindows(current_detect_hw) diff --git a/ahk/_sync/engine.py b/ahk/_sync/engine.py index e6d2da8..cbf44eb 100644 --- a/ahk/_sync/engine.py +++ b/ahk/_sync/engine.py @@ -3302,6 +3302,10 @@ def win_wait( """ Analog for `WinWait `_ """ + if not title and not text and not exclude_title and not exclude_text: + raise ValueError( + 'Expected non-blank value for at least one of the following: title, text, exclude_title, exclude_text' + ) args = self._format_win_args( title=title, text=text, diff --git a/ahk/templates/daemon-v2.ahk b/ahk/templates/daemon-v2.ahk index 78e815f..6989193 100644 --- a/ahk/templates/daemon-v2.ahk +++ b/ahk/templates/daemon-v2.ahk @@ -2341,7 +2341,7 @@ AHKWindowList(args*) { AHKControlClick(args*) { {% block AHKControlClick %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] title := args[2] text := args[3] button := args[4] @@ -2368,7 +2368,7 @@ AHKControlClick(args*) { } try { - ControlClick(ctrl, title, text, button, click_count, options, exclude_title, exclude_text) + ControlClick(ctrl || unset, title, text, button, click_count, options, exclude_title, exclude_text) } finally { DetectHiddenWindows(current_detect_hw) @@ -2383,7 +2383,7 @@ AHKControlClick(args*) { AHKControlGetText(args*) { {% block AHKControlGetText %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] title := args[2] text := args[3] extitle := args[4] @@ -2423,7 +2423,7 @@ AHKControlGetText(args*) { AHKControlGetPos(args*) { {% block AHKControlGetPos %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] title := args[2] text := args[3] extitle := args[4] @@ -2462,7 +2462,7 @@ AHKControlGetPos(args*) { AHKControlSend(args*) { {% block AHKControlSend %} - ctrl := args[1] + ctrl := IsNumber(args[1]) ? Number(args[1]) : args[1] keys := args[2] title := args[3] text := args[4] @@ -2487,11 +2487,7 @@ AHKControlSend(args*) { } try { - if (ctrl != "") { - ControlSend(keys, ctrl, title, text, extitle, extext) - } else { - ControlSend(keys,, title, text, extitle, extext) - } + ControlSend(keys, ctrl || unset, title, text, extitle, extext) } finally { DetectHiddenWindows(current_detect_hw)