I'm trying to close a particular java.exe window that I gave a custom title when I launched it from cmd. Here's what it looks like in windowSpy.ahk:
CloseMe
ahk_class ConsoleWindowClass
ahk_exe java.exe
ahk_pid xx_Changes_Every_Time_xxHere's my code:
SetTitleMatchMode, 2
#WinActivateForce
DetectHiddenWindows, On
IfWinExist, "ahk_exe java.exe" MsgBox, Exists
Else MsgBox, Does Not ExistAnd I keep getting "Does Not Exist" despite my many efforts:
- Used the title (CloseMe), class (ahk_class ConsoleWindowClass) and exe (ahk_exe java.exe)
WinActivate, "CloseMe"(and the rest)WinClose, "CloseMe"WinGet, w_list, List, "Close"
It seems like Window Spy has no problem telling me the aspects of this window, but AHK will not allow me to activate it.
1 Answer
You're not supposed to have quotes on the title, unless you're concatenating it.
WinActivate, CloseMe
WinClose, CloseMe 1