Not getting active window title.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
iwrk4dedpr
Posts: 16
Joined: 18 Aug 2014, 23:01

Not getting active window title.

03 Feb 2015, 17:52

I've been using autohotkey for ages. But last night my key scripts worked fine. My scripts run based on the title of the active screen. So I use the command

Code: Select all

WinGetActiveTitle, Title 
I would return strings like "Title = KIXEYE.com - Google Chrome" now today I get on and poof scripts are not working. I look at the variable Title is blank.

Does anybody know what I need to troubleshoot to figure out why stuff stopped working? The WinGetActiveTitle seems to be a basic command. As far as I know ...

1. No windows update ( that's set to be manual )
2. No Chrome update ( not sure if that's automatic )
3. Far as I know ... no update to autohotkey

4. Have rebooted ... couple of times ... no change


Between last night and when I got on today I believe NOTHING has happened. No happy baby fingers on PC, no unwarranted reboots, etc...
iwrk4dedpr
Posts: 16
Joined: 18 Aug 2014, 23:01

Re: Not getting active window title.

03 Feb 2015, 17:55

Here is the "Window Spy Contents"
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
KIXEYE.com - Google Chrome
ahk_class Chrome_WidgetWin_1

>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 792, 630 (less often used)
In Active Window: 792, 630

>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
ClassNN: Chrome_RenderWidgetHostHWND1
Text: Chrome Legacy Window
Color: 0xC8D0D4 (Blue=C8 Green=D0 Red=D4)

>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 0 top: 0 width: 1440 height: 900

>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<

>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
Chrome Legacy Window

>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<

>>>>( TitleMatchMode=slow Visible Text )<<<<

>>>>( TitleMatchMode=slow Hidden Text )<<<<
User avatar
Almost_there
Posts: 404
Joined: 30 Sep 2014, 10:32

Re: Not getting active window title.

03 Feb 2015, 18:20

Could it be the unlikely event of another window on top with a empty title.

I know about at least one program (waste database program running on external desktop) that is very non-consistent about the active window name, sometimes it's just empty. May this be same issue?
iwrk4dedpr
Posts: 16
Joined: 18 Aug 2014, 23:01

Re: Not getting active window title.

03 Feb 2015, 18:30

Not sure .. nothing has changed on the computer ( nothing new running )

I wanted to see exactly what was in Title so I put

Code: Select all

MsgBox, - %Title% -

And Title does have the string it should have.
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: Not getting active window title.

03 Feb 2015, 19:16

Does anybody know what I need to troubleshoot to figure out why stuff stopped working?
good question.
can't tell you the problem, but some things to troubleshoot maybe:
if the taskbar is active for example the WinGetActiveTitle returns empty string
is that line is the only code in your script? aside from a hotkey or timer
if not try it using a hotkey or a timer, 100ms seems good, and use WinActive() get the active window (your window), and get its information, even WinGetTitle
try the API functionGetWindowText(), I'm not sure how still accurate a 12 years old entry but The secret life of GetWindowText from oldnewthing it may or may not be related
just throwing things out there with a huge maybe, good luck
iwrk4dedpr
Posts: 16
Joined: 18 Aug 2014, 23:01

Re: Not getting active window title.

03 Feb 2015, 23:28

I'll attach my code .... But I've never been motivated to really understand the coding for AHK so please go gentle on the criticism (please!)

Hmmm well I can't maybe I don't have enough posts.

Here is the top portion of the code! When the variable Title contains the appropriate text in it see previous posts on how I know it has the value. It won't enter the appropriate if statement.

Code: Select all

^!s::Suspend  
^!PgDn::Suspend  
$F1::
$F2::
$F3::
$F4::
$F5::
$F6::
$F7::
$F8::
$F9::
$F10::
$F11::
$F12::
DetectHiddenText, on
SetTitleMatchMode 2
SetTitleMatchMode, slow
WinGetActiveTitle, Title
WinGetClass, class, A
MsgBox, The active window's class is "%class%".
FleetsOut := 10
KeyType := "Evt"
KeyType := "Testing"
KeyType := "SpamAttack"
KeyType := "Reg"
FltRes  := "68,280,060 --> 204,850 BaseXP ----> 1xp for each 333.3 res"
If Title = Adobe Flash Player
{
	while GetKeyState("F1", "P") 	{
		Return
	}
	while GetKeyState("F2", "P") 	{
	}
	while GetKeyState("F3", "P") 	{
		Return
	}
	while GetKeyState("F4", "P") 	{
		Return
	}
	while GetKeyState("F5", "P") 	{
		Return
	}
	while GetKeyState("F6", "P") 	{
		Return
	}
	while GetKeyState("F7", "P") 	{
		Return
	}
	while GetKeyState("F8", "P") 	{
		Return
	}
	while GetKeyState("F9", "P") 	{
		Return
	}
	while GetKeyState("F10", "P")	{
		Return
	}
	while GetKeyState("F11", "P")	{
		Return
	}
	while GetKeyState("F12", "P")	{
		Reload
		Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
		MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
		IfMsgBox, Yes, Edit
		return
	}
	return
}
ELSE If Title = KIXEYE.com - Google Chrome
{

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, RussF and 206 guests