Alternatives to Window Spy Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Alternatives to Window Spy

31 Oct 2018, 19:28

I used only Window Spy for years and worked great. Couple months back swagfag, IIRC, told me about ahk.exe option. That resolved issues I had with several applications in which Window Spy would not work for me, so that was awesome :thumbsup:

I have a game now in which neither of the following work:
-------------------------------------------------------------------------------------------------------------
#IfWinActive Max Payne 1 - Fri Sep 19 13:41:50 2003 Build 97 ahk_class MaxPayne2
or
#IfWinActive ahk_exe MaxPayne2.exe<----------------------------------- ;corrected my initial type-0 11-11-18 @ 3:11 PM
-------------------------------------------------------------------------------------------------------------

Am I missing something here? Is there some other way that AHK can run in this game?

:beard:<--- humbled by my ignorance, I feel it unwise to boast about my awesome beard until I have been schooled by the pros
Last edited by Evil-e on 11 Nov 2018, 18:12, edited 2 times in total.
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Alternatives to Window Spy

05 Nov 2018, 10:13

what specifically are you trying to do with your script in this game? perhaps the IfWinActive is working, but your other commands aren't.. post the full script

Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Alternatives to Window Spy

05 Nov 2018, 12:10

Hey, pepes :)

I am unable to get any script working for this game, as neither the window spy code nor ahk.exe method will send commands to it.
I first tried the basic y::e to see if my character moves forward and he does not. BTW, I think that WASD was not well thought out
by the early designers of key mapping for games. EDSF makes more sense for optimal LH access to keys.... but I digress :)

I guess the question I should be asking, is if there is a way for AHK to run on ANY window that happens to be running on my PC?
I would just make sure that no applications or explorer windows were open at the time of playing this particular game.

:beard: <--- has grown a little, but I'm still not worthy

PS> I have tried windowed-mode, as some games will only respond to AHK in this way.... but no go
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
CyL0N
Posts: 211
Joined: 27 Sep 2018, 09:58

Re: Alternatives to Window Spy  Topic is solved

11 Nov 2018, 14:17

1. What swagfag said, ahk_exe NOT ahk.exe
,as in #IfWinActive ahk_exe MaxPayne2.exe

2.You could try y::send, {e down}

3.Putting a hotkey outside of an #IfWinActive block or not using it at all will result in a hotkey that works anywhere.

Cheers
live ? long & prosper : regards
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Alternatives to Window Spy

11 Nov 2018, 22:21

OK...... I got it to work :superhappy:

@ swag & cyLON.... I had a type-0 in my initial post, as I do have #IfwinActive ahk_exe MaxPayne.exe

Max Payne launches a dialog box for initial settings & with a button to launch the game. AHK MUST be executed
after this dialog box and PRIOR to "Play" button to launch game itself. Windows will crash if ALT+TAB or CTRL+ALT+DELETE
is used to attempt access to Desktop (windowed mode can avoid this issue, but requires many steps to get back to game)

This is the code I am using (minus the WinWait & WinWaitClose options)
------------------------------------------------------------------------------
#IfWinActive ahk_exe MaxPayne.exe<--------------------------------------------------------------;this works, as AHK run and inputs console code
WinWait, ahk_exe MaxPayne.exe,
WinWait, Max Payne 1 - Fri Sep 19 13:41:50 2003 Build 97 ahk_class MaxPayne2<----------;some games work with Window Spy, not this one
WinWaitClose, ahk_exe MaxPayne.exe<-----------------------------------------------------------;will not terminate AHK upon exit
WinWaitClose, Max Payne 1 - Fri Sep 19 13:41:50 2003 Build 97 ahk_class MaxPayne2
return
$F11::ExitApp<------------------------------------------------------------- ;Prior to exit game or right-click on sys tray to close AHK
return
$F3::
{
send {F12 down}
sleep, 100
send {F12 up}
sleep, 100
send {F12 down}
sleep, 100
send {F12 up}
sleep, 100
send GetAllWeapons {enter}<--------------------------------------;all this for THAT
sleep, 100
send {F12 down}
sleep, 100
send {F12 up}
sleep, 100
send {F12 down}
sleep, 100
send {F12 up}
sleep, 100
}
return
------------------------------------------------------------------------------
"F12" launches console so Max can load up on all the cool weapons that normally take the entire playthrough to aquire :thumbup:
Beauty is, and found this out only a few minutes ago. If a save file is created after the above console code has been input, I can
then skip AHK going forward. These weapons will be available when I launch that save.

So...... after nearly 2 weeks of on /off trying to figure out all this stuff. I could have just opened the console, typed GetAllWeapons,
key ENTER and save game avoiding AHK completely. Knowing what I know now.... well, I probably would have not done anything different,
cuz I seem to like doing this----> :headwall: :crazy:

WinWait & WinWaitClose options will just not work, but I don't much care at this point.

Many thanks to all who contributed to my journey :)

:morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750, septrinus and 266 guests