Jump to content


Photo

How to find out Window title for 'WinWait' & 'WinWaitClose'


  • Please log in to reply
4 replies to this topic

#1 Wade007

Wade007
  • Members
  • 21 posts

Posted 12 July 2012 - 02:39 AM

I'm coding AHK a file to close itself once "Big Buck Hunter" 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 the following code will 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 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.

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

Thanks in advance.

#2 dylan904

dylan904
  • Members
  • 706 posts

Posted 12 July 2012 - 03:06 AM

On a line prior to your efforts, just insert this line and try again, and see if it helped
SetTitleMatchMode, 2

#3 girlgamer

girlgamer
  • Moderators
  • 2039 posts

Posted 12 July 2012 - 09:20 AM

Activate your game window and use the following routine with Ctrl_Alt_MButton to find the game window information..
You can also add this to your own working scripts.

#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


#4 Wade007

Wade007
  • Members
  • 21 posts

Posted 12 July 2012 - 02:00 PM

Thanks guys. Let me try these suggestions and I'll repost.

#5 Wade007

Wade007
  • Members
  • 21 posts

Posted 13 July 2012 - 06:37 AM

girlgamer,
THANK YOU!!! Your idea and script made ALL the difference!!! You're a genius.

I used to your script to find out from the generated TestFile.txt that...

wintitle: BBH
winclass: PMVsClass

'BBH' is the title I was looking for!! I plugged that into my existing script and BAM!!!...works just like a champ!

I'm not sure how knowing the winclass would help me. :?: Obviously, I'm quite the novice at AHK.

Thanks to you too dylan904. Your suggestion was on the right track as well, I just didn't know exactly how to set it up completely. I tried unsuccessfully with this script:

SetTitleMatchMode 2
WinGetActiveTitle Title
WinWait, Title
WinWaitClose, Title
exit App

Also tried using AU3_spy.exe to get the report on the Window title & Alt+Enter in gamemode to try and force a windowed experience. All of these attempts and other failed, but girlgamer's script WAS THE SOLUTION!! You win the prize!!! I'll hang onto your script for future use.

Thanks again. Awesome!! :D :D :D :D