Binding esc to taskkill

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
snax087
Posts: 4
Joined: 26 Jul 2021, 20:39

Binding esc to taskkill

08 Oct 2023, 15:08

Hey guys. I'm not an AHK master by any means but i'm really close to figuring this out but i need just a little more help to complete it. I'm trying to run a script that will send a taskkill command when the Esc key is hit ONLY while a specific program is running so the command isnt always being sent when the Esc key is hit. This is my script so far

Code: Select all

ESC::
{	
    	SetTitleMatchMode, 2
	WinActivate, ahk_exe RPCS3.exe
	run taskkill /F /IM RPCS3.exe,, Hide

  return   			
}
It works but i'm not sure if it's ONLY doing the taskkill when RPCS3.exe is detected/running or not. I think maybe a Loop might be needed? Any help would be appreciated. Thanks :)


[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
GEV
Posts: 1005
Joined: 25 Feb 2014, 00:50

Re: Binding esc to taskkill

08 Oct 2023, 15:20

See https://www.autohotkey.com/docs/v1/lib/_IfWinActive.htm
If there is something you don't understand, feel free to ask.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: apeironn, fiaztv1, JKJadan, Pianist and 170 guests