AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tooltip text repetition

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
infogulch



Joined: 27 Mar 2008
Posts: 649

PostPosted: Thu Mar 11, 2010 4:27 am    Post subject: Tooltip text repetition Reply with quote

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
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Thu Mar 11, 2010 4:31 am    Post subject: Reply with quote

What the... Confused

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
View user's profile Send private message Visit poster's website
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu Mar 11, 2010 5:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Thu Mar 11, 2010 7:09 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
alpha
Guest





PostPosted: Thu Mar 11, 2010 7:45 am    Post subject: Reply with quote

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. Confused
Back to top
Roland



Joined: 08 Jun 2006
Posts: 307

PostPosted: Thu Mar 11, 2010 10:10 am    Post subject: Reply with quote

Quote:
Code:
WinGetTitle, Title, new file - metapad,, ahk_class tooltips_class32

By my understanding this should exclude the tooltip window. Confused


ahk_class, ahk_pid, etc. are only valid in the WinTitle parameter, but not the ExcludeTitle parameter. Got me once too Confused
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Sat Mar 27, 2010 1:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
alpha
Guest





PostPosted: Sat Mar 27, 2010 2:50 pm    Post subject: Reply with quote

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. Wink 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

PostPosted: Thu Apr 01, 2010 8:41 pm    Post subject: Reply with quote

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.
Shocked
So this is an official bug then?
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu Apr 01, 2010 8:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Guest






PostPosted: Thu Apr 01, 2010 11:42 pm    Post subject: Reply with quote

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.
Shocked
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

PostPosted: Fri Apr 02, 2010 12:22 am    Post subject: Reply with quote

Thnx, I get that part.
Shouldnt the var reset itself each iteration rather than concat?
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 649

PostPosted: Fri Apr 02, 2010 1:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group