Bug - TEXAS SIZE ToolTip Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
andymbody
Posts: 867
Joined: 02 Jul 2017, 23:47

Bug - TEXAS SIZE ToolTip

03 Jul 2017, 00:32

Run this... works normal when a window is active, BUT... open only a single window (works fine), then use the minimize button to minimize this window
and only show the desktop (must use minimize, not "show desktop" button)... and watch the fireworks! The ToolTip grows to the size of Texas until you run out of memory!

Seems to be related to a combination with:
1. The variable recieved (winTitle) when using WinGetTitle
2. Using concatination with this variable (or variables associated with the winTitle var) (winTitle seems to grow recursively with text that it's concatinated with - why??)
Trying to save winTitle into a separate variable and using that variable to concatinate still results in the same issue
3. Displaying result as ToolTip (msgbox doesnt seem to do this)
4. Minimizing the single window to show only the desktop.

Take any one of these out of the equation and the problem goes away.

I'm thinking WinGetTitle is the culprit but after many hours with trial and error debugging, I throw up my hands!

Windows7 SP1 AKH 1.1.26.00

Code: Select all

#Persistent
SetTimer, Mouse_Window_Info, 100
return

Mouse_Window_Info:
	Mouse_Window_Info()
	return

Mouse_Window_Info() {

	WinGetTitle, winTitle, A
	tt := "Active window Title is: " . winTitle
	ToolTip, % tt
}
Attachments
TestWinActive.ahk
(231 Bytes) Downloaded 18 times
Last edited by andymbody on 03 Jul 2017, 09:37, edited 1 time in total.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 01:24

I can confirm this. After switching to the Desktop the last thing put into the ToolTip is put into WinTitle.
Recommends AHK Studio
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Bug - TEXAS SIZE ToolTip  Topic is solved

03 Jul 2017, 02:44

When you minimise the window the tooltip becomes the active window. :wave:
Edit:
To remedy:

Code: Select all

Mouse_Window_Info() {
	WinGetClass,cls,A
	if (cls = "tooltips_class32")
		return
Edit 2:
FYI, you can omit the label.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 04:08

Oh wow I should have thought of this
Recommends AHK Studio
User avatar
andymbody
Posts: 867
Joined: 02 Jul 2017, 23:47

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 09:26

Helgef wrote:When you minimise the window the tooltip becomes the active window. :wave:
Edit:
To remedy:

Code: Select all

Mouse_Window_Info() {
	WinGetClass,cls,A
	if (cls = "tooltips_class32")
		return
Edit 2:
FYI, you can omit the label.
Helgef, Thank you!! :bravo: I knew it had something to do with the desktop becoming the active window, but could not figure out how this was causing the ToolTip to become recursive like that.

I never even considered that the ToolTip itself was the active window is this case. How did you figure this out?

Also... Edit 2 - The code I am writing has much more to it but I was able to narrow down the key factors and include only them here. I have my keys and functions separated into different files using #Include - this is the reason for the label calling the function. I could have left this out of the example code but wanted to include anything that might be a factor to this problem.

I'm relatively new to AHK (not new to coding) and find it rather buggy and HATE that it"s not strictly Typed - this causes 10 times more debugging effort on my part (wish there was a strictly Typed alternative). I'm sure there is a way for SetTimer to call a function directly (rather than going through a label) but still looking into it.

Thanks Again!!
Andy

Bug Fixed using your suggestion!

Code: Select all

Mouse_Window_Info() {
	
	WinGetClass, cls, A
	if (cls == "tooltips_class32") {
		; desktop is active window
		winTitle := "Desktop"
	}
	Else
	{
		WinGetTitle, winTitle, A
	}
	
	tt := "Active window Title is: " . winTitle
	ToolTip, % tt
}
Last edited by andymbody on 03 Jul 2017, 10:22, edited 3 times in total.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 09:38

For debugging you could just increase the delay to 1 second, to then see how/why the ToolTip was growing in size. Also in this case, slightly unintuitively, the 'window title' for a ToolTip window is the ToolTip's text.

Re. typed: I find that "" var or var+0 to force type normally fixes all ills. I think that on the whole it's better that it isn't forced, I'd have to see more arguments for forcing it.
Last edited by jeeswg on 03 Jul 2017, 09:44, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 09:42

I'm sure there is a way for SetTimer to call a function directly (rather than going through a label) but still looking into it.
If you remove the label, it will call the function (which has the same name).

For debugging, I find this very useful, DebugVars.
I the end you might find that the untyped nature of ahk is very convenient.

Good luck
User avatar
andymbody
Posts: 867
Joined: 02 Jul 2017, 23:47

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 10:30

jeeswg wrote:For debugging you could just increase the delay to 1 second, to then see how/why the ToolTip was growing in size. Also in this case, slightly unintuitively, the 'window title' for a ToolTip window is the ToolTip's text.

Re. typed: I find that "" var or var+0 to force type normally fixes all ills. I think that on the whole it's better that it isn't forced, I'd have to see more arguments for forcing it.
jeeswg, thanks for the suggestions!

I had slowed it down and was able to make out that the tooltip was becoming recursive, but was unable to come to the conclusion that the tooltip itself had become the active window in this case... just didnt even cross my mind. It hindsight it now makes sense!

Thanks!
User avatar
andymbody
Posts: 867
Joined: 02 Jul 2017, 23:47

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 10:33

Helgef wrote:For debugging, I find this very useful, DebugVars.
Thank you!! I will check this out!
Helgef wrote:If you remove the label, it will call the function (which has the same name).
I had tried this before and for some reason it didnt work - works now tho! :wtf:
Oh!! maybe because I was using an older version of AHK...

Thanks!
User avatar
andymbody
Posts: 867
Joined: 02 Jul 2017, 23:47

Re: Bug - TEXAS SIZE ToolTip

03 Jul 2017, 11:41

Y'all have been fantastic!! Thank you very much for all the assistance!! :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: dunnerca and 159 guests