how to hide a menu item when a Process Name is not detected. Deleted Item1 when the variable "ProcessNameEXE" does not equal "Explorer.EXE" Why it's not working ? Any help is appreciated.
Code: Select all
Menu, MyMenu, Add, Item1, MenuHandler1
if (ProcessNameEXE != Explorer.EXE) {
Menu, MyMenu, Delete, Item1
}
Menu, MyMenu, Add, Item2, MenuHandler2
Return
MenuHandler1:
return
MenuHandler2:
return
MButton::
MouseGetPos, xpos, ypos, Window, ClassNN
WinGet, ProcessNameEXE, ProcessName, ahk_id %Window%
Msgbox, %ProcessNameEXE%
Menu, MyMenu, Show