Last active
November 13, 2017 21:48
-
-
Save davebrny/ab814d0427a67237008dd7888cc464bd to your computer and use it in GitHub Desktop.
(autohotkey) - check the text in a msgbox for trailing characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode 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 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"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