Skip to content

Commit

Permalink
add WinGetTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Nov 12, 2022
1 parent c5294e3 commit cfca4be
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AHK_X11 can be used completely without a terminal. You can however if you want u
<details><summary><strong>CLICK TO SEE WHICH COMMANDS ARE IMPLEMENTED AND WHICH ARE MISSING</strong>. Note however that this is not very representative. For example, no `Gui` sub command is included in the listing. For a better overview on what is already done, skim through the <a href="https://phil294.github.io/AHK_X11">docs</a>.</summary>

```diff
DONE ?% (78/217):
DONE ?% (79/217):
+ Else, { ... }, Break, Continue, Return, Exit, GoSub, GoTo, IfEqual, Loop, SetEnv, Sleep, FileCopy,
+ SetTimer, WinActivate, MsgBox, Gui, SendRaw, #Persistent, ExitApp,
+ EnvAdd, EnvSub, EnvMult, EnvDiv, ControlSendRaw, IfWinExist/IfWinNotExist, SetWorkingDir,
Expand All @@ -66,7 +66,8 @@ DONE ?% (78/217):
+ IniWrite, Loop (files & folders), Loop (read file contents), MouseClick, Pause, Reload,
+ StringGetPos, StringLeft, StringLen, StringLower, StringMid, StringReplace, StringRight,
+ StringUpper, Suspend, URLDownloadToFile, WinClose, WinGetPos, WinKill, WinMaximize, WinMinimize,
+ WinMove, WinRestore, MouseGetPos, MouseMove, GetKeyState, KeyWait, ControlClick, WinGetText
+ WinMove, WinRestore, MouseGetPos, MouseMove, GetKeyState, KeyWait, ControlClick, WinGetText,
+ WinGetTitle

NEW 3% (6/217): (not part of spec or from a more recent version)
@@ Echo, ahk_x11_print_vars, FileRead, RegExGetPos, RegExReplace, EnvGet @@
Expand All @@ -80,7 +81,7 @@ REMOVED 6% (12/217):
# AutoTrim: It's always Off. It would not differentiate between %a_space% and %some_var%.
# It's possible but needs significant work.

TO DO ?% (117/217): alphabetically
TO DO ?% (116/217): alphabetically
- BlockInput, ClipWait, Control, ControlFocus, ControlGet, ControlGetFocus,
- ControlGetPos, ControlGetText, ControlMove, ControlSetText, CoordMode,
- DetectHiddenText, DetectHiddenWindows, Drive, DriveGet, DriveSpaceFree,
Expand All @@ -100,7 +101,7 @@ TO DO ?% (117/217): alphabetically
- StatusBarWait, StringCaseSense, StringSplit, StringTrimLeft, StringTrimRight,
- SysGet, Thread, ToolTip, Transform, TrayTip, WinActivateBottom,
- WinGetActiveStats, WinGetActiveTitle, WinGetClass, WinGet,
- WinGetTitle, WinHide, WinMenuSelectItem, WinMinimizeAll,
- WinHide, WinMenuSelectItem, WinMinimizeAll,
- WinMinimizeAllUndo, WinSet, WinSetTitle, WinShow, WinWait, WinWaitActive,
- WinWaitClose, WinWaitNotActive, #CommentFlag, #ErrorStdOut, #EscapeChar,
- #HotkeyInterval, #HotkeyModifierTimeout, #Include, #MaxHotkeysPerInterval, #MaxMem,
Expand Down
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ <h2>Table of contents </h2>
<a href="#WinGetText.htm">WinGetText</a>
</li>
<li>
<a class="tbd" href="#WinGetTitle.htm">WinGetTitle</a>
<a href="#WinGetTitle.htm">WinGetTitle</a>
</li>
<li>
<a class="tbd" href="#WinHide.htm">WinHide</a>
Expand Down Expand Up @@ -2724,7 +2724,7 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
<td height="16" class="calibre4">Retrieves the text from a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a></td>
<td height="16" class="calibre4"><a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a></td>
<td height="16" class="calibre4">Retrieves the full title from a window.</td>
</tr>
<tr class="calibre3">
Expand Down Expand Up @@ -14345,7 +14345,6 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
MsgBox, The text is:`n%text%</pre>
</div>
</div>
<div class="tbd">
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinGetTitle.htm" href="#WinGetTitle.htm">#</a> <h2 class="calibre17">WinGetTitle</h2>
Expand Down Expand Up @@ -14397,6 +14396,7 @@ <h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2
MsgBox, The active window is "%Title%".</pre>
</div>
</div>
<div class="tbd">
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinHide.htm" href="#WinHide.htm">#</a> <h2 class="calibre17">WinHide</h2>
Expand Down
15 changes: 15 additions & 0 deletions src/cmd/x11/window/win-get-title.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require "./win-util"

class Cmd::X11::Window::WinGetTitle < Cmd::Base
def self.min_args; 1 end
def self.max_args; 5 end
def run(thread, args)
match_conditions = args[1..]? || [] of ::String
out_var = args[0]
Util.match(thread, match_conditions, empty_is_last_found: true, a_is_active: true) do |win|
thread.runner.set_user_var(out_var, win.name || "")
return
end
thread.runner.set_user_var(out_var, "")
end
end

0 comments on commit cfca4be

Please sign in to comment.