Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Wade007 on July 11, 2012, 10:47:18 pm

Title: How to identify game Windows title for AHK coding? [SOLVED!!]
Post by: Wade007 on July 11, 2012, 10:47:18 pm
I'm coding an AHK file to close itself once "Big Buck Hunter" game closes on the PC.

Problem is, the game automatically goes full screen at launch and I can't find out the name/title of the window in which it runs so that the following code might work:

WinWait, Big Buck Hunter ; This isn't the right Window title. Don't know how to find out!!!
WinWaitClose, Big Buck Hunter
exit App

There isn't an options area in any menu launch screen whereby I can make it run windowed or lower resolution, so I can see what Windows calls the running game, so I can then in turn correctly fix the code above. The rest of my script seems to work fine. I just can't code for the situation in which Big Buck Hunter get's closed via the menu system and AHK must then close itself.

Anyone know how to find out Windows title info with a game that only runs full screen?

Thanks in advance.
Title: Re: How to identify game Windows title for AHK coding?
Post by: BadMouth on July 11, 2012, 11:31:24 pm
CTRL+ALT+DELETE and bring up windows task manager.  ;)
Title: Re: How to identify game Windows title for AHK coding?
Post by: RamjetR on July 11, 2012, 11:41:49 pm
I'll 2nd on A+C+D Task Manager.

Also some/most games will respond to an Alt-Enter as a windows shortcut to FullScreen/Window mode.

Ramjet
Title: Re: How to identify game Windows title for AHK coding?
Post by: drventure on July 12, 2012, 12:05:16 am
The version of AHK that i installed came with AU3_spy.exe

Just run it and click on a window, it'll show window titles, classes, and all sorts of extra stuff that's handy for AHK scripts.
Title: Re: How to identify game Windows title for AHK coding?
Post by: Wade007 on July 12, 2012, 09:50:29 am
Thanks for your response guys. The AU3_spy.exe idea sounds promising. I'll try that.

I had tried Ctrl-Alt-Delete and then Task Manager before posting but that just shows the executable running, not necessarily the name of the window.

I'll try a few more things and repost. Thanks again for your help.
Title: Re: How to identify game Windows title for AHK coding?
Post by: Wade007 on July 13, 2012, 02:59:21 am
OK, I'm back...problem solved. Return posting here so that others might benefit.

Tried using AU3_spy.exe to get the report on the Window title AND tried Alt+Enter in game mode to try and force a windowed experience. Neither worked. The game didn't respond to Alt+Enter and I couldn't figure out how to point AU3.spy to an already active window and still see AU3.spy for the report at the same time. Maybe I was doing something wrong but it didn't seem possible to run the game AND see AU3.spy at the same time.

HOWEVER... I got some more help from an AHK expert on the AHK forum. http://www.autohotkey.com/community/viewtopic.php?f=15&t=88694&p=550621#p550621 (http://www.autohotkey.com/community/viewtopic.php?f=15&t=88694&p=550621#p550621)

See script below. After launching the game via the script I simply pressed Ctrl+Alt+MButton to find the game window information desired via a generated Testfile (Testfile.txt).


SetWorkingDir, C:\Arcade\PC Arcade Ports\Big Buck Hunter\BBH1
Run, C:\Arcade\PC Arcade Ports\Big Buck Hunter\BBH1\BBH1.exe

#SingleInstance, Force
SetTitleMatchMode, 2
Return

^!mbutton::
winget, winid, ID, A
WinGetTitle, wint, ahk_id %winid%
winGetClass, winc, ahk_id %winid%
IfExist, %A_WorkingDir%\TestFile.txt
   FileDelete, %A_WorkingDir%\TestFile.txt
fileappend wintitle: %wint%`n, %A_WorkingDir%\TestFile.txt
FileAppend,winclass: %winc%`n, %A_WorkingDir%\TestFile.txt
winminimize, ahk_id %winid%
run, notepad %A_WorkingDir%\testfile.txt
Return


The generated TestFile.txt reported:
wintitle: BBH
winclass: PMVsClass

I'm not sure how knowing the winclass would help me but after I plugged 'BBH' into my previous simple script everything worked perfectly!!! Case solved!!!