Distinction Between an Open Folder and the Desktop/Taskbar

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Alexander2
Posts: 348
Joined: 27 Apr 2019, 17:38

Distinction Between an Open Folder and the Desktop/Taskbar

06 Aug 2020, 05:34

I have used the following commands to obtain information about the window or program below the mouse cursor:

Code: Select all

MouseGetPos,,, mp
WinGet, prn, ProcessName, ahk_id %mp%
WinGetTitle, tit, ahk_id %mp%
The program is to take a specified action if the mouse cursor is above an open folder but is take no action when the cursor is above the desktop or taskbar. What “If” command should be used to make this distinction between an open folder and the desktop/ taskbar?
mshafer1
Posts: 54
Joined: 16 Jul 2017, 14:49
Contact:

Re: Distinction Between an Open Folder and the Desktop/Taskbar

06 Aug 2020, 13:07

If I understand correctly, you want to check if the active "window" (or process) is a window of Explorer (open to some folder), or just the desktop - both of which are from the Explorer.EXE process.

I've found the the ahk class (as in WinGetClass) to be effective.
If desktop is active: this equals "WorkerW", else: it equals "CabinetWClass"

I've used

Code: Select all

IfNotWinActive, ahk_class WorkerW
{
; not on the desktop - do something
}
for something similar before (in my case, I wanted F5 to trigger a code deploy, if the Desktop was the active "window", else pass it through)
Alexander2
Posts: 348
Joined: 27 Apr 2019, 17:38

Re: Distinction Between an Open Folder and the Desktop/Taskbar

07 Aug 2020, 05:23

mshafer1 wrote:
06 Aug 2020, 13:07
If I understand correctly, you want to check if the active "window" (or process) is a window of Explorer (open to some folder), or just the desktop - both of which are from the Explorer.EXE process.
Yes, I need to check whether the mouse cursor is above an open folder (which has a title) or simply above Explorer.exe (which does not have a window title).
mshafer1 wrote:
06 Aug 2020, 13:07
I've found the the ahk class (as in WinGetClass) to be effective.
If desktop is active: this equals "WorkerW", else: it equals "CabinetWClass"

I've used

Code: Select all

IfNotWinActive, ahk_class WorkerW
{
; not on the desktop - do something
}
for something similar before (in my case, I wanted F5 to trigger a code deploy, if the Desktop was the active "window", else pass it through)
I have tried using the command “If Not WinActive, ahk_class WorkerW,” but it does not differentiate between an open folder and the desktop/ taskbar in Windows 10.

The command “WinGetTitle, tit, ahk_id %mp%” retrieves the title of an open folder into the “tit” variable. When the information is retrieved from the desktop, I guess that the title is empty. (I do not know how to check whether it is empty.) What “If” command can be used to check whether the title is empty and thus to determine whether the mouse cursor is above an open folder or the desktop/ taskbar?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: kashmirLZ and 208 guests