IfWinExist, WinActivate are not detecting java.exe windows

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_xx

Here's my code:

SetTitleMatchMode, 2
#WinActivateForce
DetectHiddenWindows, On
IfWinExist, "ahk_exe java.exe" MsgBox, Exists
Else MsgBox, Does Not Exist

And I keep getting "Does Not Exist" despite my many efforts:

  1. Used the title (CloseMe), class (ahk_class ConsoleWindowClass) and exe (ahk_exe java.exe)
  2. WinActivate, "CloseMe" (and the rest)
  3. WinClose, "CloseMe"
  4. 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like