Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active November 13, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davebrny/ab814d0427a67237008dd7888cc464bd to your computer and use it in GitHub Desktop.
Save davebrny/ab814d0427a67237008dd7888cc464bd to your computer and use it in GitHub Desktop.
(autohotkey) - check the text in a msgbox for trailing characters
~RButton::
mouseGetPos, cursor_x, cursor_y, , control_under_cursor
if winActive("ahk_exe AutoHotkey.exe") and winActive("ahk_class #32770")
and (control_under_cursor = "Button1") ;# if msgBox window
{
winGetText, msg_text, a
loop
{ ; remove button text
controlGetText, button_text, % "button" a_index, a
stringReplace, msg_text, msg_text, % button_text "`r`n", ,
}
until (button_text = "")
toolTip, % ">>" rTrim(msg_text, "`r`n") "<<", cursor_x, cursor_y + 30, 20
setTimer, msg_tool_timer, 2000
}
if (tooltip_under() = true) ;# if tooltip
{
controlGetText, tool_text, , ahk_class tooltips_class32
if (subStr(tool_text, 1, 2) = ">>") and (subStr(tool_text, -1, 2) = "<<")
tool_text := subStr(tool_text, 3, strLen(tool_text) -4)
clipboard := tool_text
toolTip, msg added to clipboard, , , 20
setTimer, msg_tool_timer, 2000
}
return
msg_tool_timer:
if (tooltip_under() = false)
{
setTimer, msg_tool_timer, off
toolTip, , , , 20
}
return
tooltip_under() {
tool_id := winExist("ahk_class tooltips_class32")
mouseGetPos, , , id_under
if (id_under = tool_id)
return true
else return false
}
/*
[msgbox check]
version = 1.2
description = check the text in a msgbox for trailing characters
author = davebrny
source = https://gist.github.com/davebrny/ab814d0427a67237008dd7888cc464bd
*/
@davebrny
Copy link
Author

davebrny commented Feb 12, 2017

"ctrl + c" can be used on a msgbox to get its text but you need to paste that somewhere to see if there are any trailing spaces or linefeeds in it, so this is just a slightly quicker way of doing that

  • right click "button1" of a msgbox to show a tooltip with the text wrapped in >>arrows<<
  • right click the tooltip to have the text added to the clipboard

button1 is always the first button from the left

the tooltip will stay open as long as the cursor is hovering over it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment