AutoHotkey Community

It is currently May 27th, 2012, 4:48 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Tooltip text repetition
PostPosted: March 11th, 2010, 5:27 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 5:31 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 6:39 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
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.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 8:09 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 8:45 am 
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. :?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2010, 11:10 am 
Offline

Joined: June 8th, 2006, 9:38 pm
Posts: 307
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 :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2010, 2:05 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
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 March 28th, 2010, 3:55 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2010, 3:50 pm 
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$)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2010, 9:41 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
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.
:shock:
So this is an official bug then?

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2010, 9:44 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
TLM wrote:
So this is an official bug then?


No, it's just an unusual side effect of AHK's window title matching.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2010, 12:42 am 
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.
:shock:
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2010, 1:22 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
Thnx, I get that part.
Shouldnt the var reset itself each iteration rather than concat?

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2010, 2:05 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Yahoo [Bot] and 62 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group