| View previous topic :: View next topic |
| Author |
Message |
infogulch
Joined: 27 Mar 2008 Posts: 649
|
Posted: Thu Mar 11, 2010 4:27 am Post subject: Tooltip text repetition |
|
|
This has some very unexpected and buggy behavior:
| Code: | loop
{
WinGetTitle, Title, Untitled - Notepad
ToolTip, %Title% Repeated
}
Esc::ExitApp ;you'll want a quick exit |
It has something to do with the WinGetTitle with ToolTip. This example only breaks if WinGetTitle's outputvar is the first thing in the string, but the script I found this on repeats everything both before and after the variable.
I think I remember something like this coming up before in the bug reports but I couldn't find it.
[Moved from Bug Reports forum. ~jaco0646] _________________ Scripts - License |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Thu Mar 11, 2010 4:31 am Post subject: |
|
|
What the...
Confirmed.
I was able to reproduce this behaviour:
The text " Repeated" is added to the ToolTip's text every new iteration. _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Thu Mar 11, 2010 5:39 am Post subject: |
|
|
I can get 'Repeated' to repeat no matter which side the variable is on, in fact I can get the repeats while enclosing the variable between two pieces of text.
It seems that the message being sent by WinGetTitle is being intercepted by the ToolTip once it exists, so WinGetText retrieves the text of the ToolTip as if it were the title of the other window. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Thu Mar 11, 2010 7:09 am Post subject: |
|
|
| sinkfaze wrote: | | WinGetText retrieves the text of the ToolTip as if it were the title of the other window |
Correct! The following script shows this:
| Code: | ToolTip, this is test, 50, 50, 1
Sleep, 500
WinGetTitle, Title, this is test
ToolTip, > %Title% <, 150, 150, 2
KeyWait, F12, D
KeyWait, F12 ; yeah, press F12 to exit... |
_________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
alpha Guest
|
Posted: Thu Mar 11, 2010 7:45 am Post subject: |
|
|
I think the explanation of this behavior is very simple. The text you see in the tooltip is actually the title of the tooltip window. This can be seen using Au3Info (not sure why AU3_Spy does not show the tooltip window title). And because of the manner in which window searching is done (topmost 1st) the tooltip window is found first. And because default TitleMatchMode is 1, any window starting with %title%, will match.
| WinGet help wrote: | | Windows are retrieved in order from topmost to bottommost (according to how they are stacked on the desktop). |
| Code: | SetTitleMatchMode, 3 ; <-- include this and the problem goes away
loop
{
WinGetTitle, Title, Untitled - Notepad
ToolTip, %Title% Repeated
}
Esc::ExitApp ;you'll want a quick exit |
A side note. I would have expected this to also cure the problem, but it has no effect.
| Code: | | WinGetTitle, Title, new file - metapad,, ahk_class tooltips_class32 |
By my understanding this should exclude the tooltip window.  |
|
| Back to top |
|
 |
Roland
Joined: 08 Jun 2006 Posts: 307
|
Posted: Thu Mar 11, 2010 10:10 am Post subject: |
|
|
| Quote: | | Code: | | WinGetTitle, Title, new file - metapad,, ahk_class tooltips_class32 |
By my understanding this should exclude the tooltip window.  |
ahk_class, ahk_pid, etc. are only valid in the WinTitle parameter, but not the ExcludeTitle parameter. Got me once too  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7295 Location: Australia
|
Posted: Sat Mar 27, 2010 1:05 pm Post subject: |
|
|
I first realised the limitations of ExcludeTitle the same way, trying to exclude a tooltip which was showing me a window title. Since the tooltip was only for debugging I ended up using OutputDebug instead.
If you need to exclude windows of a particular class (or classes), RegEx can be used:
| Code: | SetTitleMatchMode, RegEx
WinGetTitle, Title, new file - metapad ahk_class ^(?!tooltips_class32$|brokenwindow$)
| Just remember to escape the appropriate characters in the window title and excluded class.
Edit:
@alpha - doh! As I don't have metapad, I did not test the code as posted.
Last edited by Lexikos on Sun Mar 28, 2010 2:55 am; edited 1 time in total |
|
| Back to top |
|
 |
alpha Guest
|
Posted: Sat Mar 27, 2010 2:50 pm Post subject: |
|
|
| Lexikos wrote: | If you need to exclude windows of a particular class (or classes), RegEx can be used:
| Code: | SetTitleMatchMode, RegEx
WinGetTitle, Title, new file - metapad,, ahk_class ^(?!tooltips_class32$|brokenwindow$)
|
| Yeah, that thought had occured to me, but I did not try it. But after reading your post I did try it, and I think you made a minor mistake. Rolands's comment appears to be valid.
| Roland wrote: | | ahk_class, ahk_pid, etc. are only valid in the WinTitle parameter, but not the ExcludeTitle parameter. | I believe you meant to use the regex to exclude the class as part of the WinTitle parameter. Testing your code as posted still exhibits the repeat problem. This however works.
| Code: | | WinGetTitle, Title, new file - metapad ahk_class ^(?!tooltips_class32$|brokenwindow$) |
|
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Thu Apr 01, 2010 8:41 pm Post subject: |
|
|
| sinkfaze wrote: | | It seems that the message being sent by WinGetTitle is being intercepted by the ToolTip once it exists, so WinGetText retrieves the text of the ToolTip as if it were the title of the other window. |
So this is an official bug then? _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Thu Apr 01, 2010 8:44 pm Post subject: |
|
|
| TLM wrote: | | So this is an official bug then? |
No, it's just an unusual side effect of AHK's window title matching. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Apr 01, 2010 11:42 pm Post subject: |
|
|
| TLM wrote: | | sinkfaze wrote: | | It seems that the message being sent by WinGetTitle is being intercepted by the ToolTip once it exists, so WinGetText retrieves the text of the ToolTip as if it were the title of the other window. |
So this is an official bug then? |
No, it is a fact (as verified using serveral "window information" utilities) that for tooltips, the "window title" is really the text of the tooltip. |
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Fri Apr 02, 2010 12:22 am Post subject: |
|
|
Thnx, I get that part.
Shouldnt the var reset itself each iteration rather than concat? _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 649
|
Posted: Fri Apr 02, 2010 1:05 am Post subject: |
|
|
| TLM wrote: | | Shouldnt the var reset itself each iteration rather than concat? |
The var is resetting itself, it's the window title (tooltip's text) that keeps being concat. _________________ Scripts - License |
|
| Back to top |
|
 |
|