ritchielawrence/cmdow

Filters

SamHasler opened this issue · 4 comments

Currently you can only filter by taskbar or window name (Caption). It would be useful to be able to filter by other criteria such as:

  • Image name
  • Window Status
    • Visibility: Visible or Hidden
    • Minimized, Maximized, Restored,
    • Active, Inactive
    • Enabled, Disabled
  • Level - i.e. filter to top level windows.
  • Size
  • Has size (width/height not 0)
  • width / height is =/>/<
  • position?

Hi SamHasler,

This might be implemented. In the meantime, you could use FINDSTR or a FOR loop to filter on everything you suggested. Here's some examples:-

rem filter level 4 windows
cmdow | findstr /r /c:"^[^ ]*[ ]4"

rem filter maximised windows
cmdow | findstr /r /c:"^[^ ]*[ ][^ ]*[ ][^ ]*[ ]Max"

rem filter active window
cmdow | findstr /r /c:"^[^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ]Act"

rem filter disabled windows
cmdow | findstr /r /c:"^[^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ]Dis"

rem filter visible windows
cmdow | findstr /r /c:"^[^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ][^]*[ ]Vis"

rem filter explorer.exe windows
cmdow | findstr /r /c:"^[^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ][^ ]*[ ][^]*[ ][^ ]*[ ]explorer"

rem filter level 4 windows
for /f "tokens=1-8*" %%a in ('cmdow') do (
  if "%%b" EQU "4" echo %%a %%b %%c %%d %%e %%f %%g %%h %%i
)

rem filter visible level 2 windows
for /f "tokens=1-8*" %%a in ('cmdow') do (
  if "%%b" EQU "2" if "%%g" EQU "Vis" echo %%a %%b %%c %%d %%e %%f %%g %%h %%i
)

rem filter visible windows wider than 1000
for /f "tokens=1-12*" %%a in ('cmdow /p') do (
  if "%%g" EQU "Vis" if %%j GTR 1000 echo %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m
)

Wow, thanks for taking the time to write that up!
On Sep 28, 2016 9:07 PM, "Ritchie Lawrence" notifications@github.com
wrote:

Hi SamHasler,

This might be implemented. In the meantime, you could use FINDSTR and a
FOR loop to filter on everything you suggested. Here's some examples:-

rem filter level 4 windows
cmdow | findstr /r /c:"^[^ ][ ]4"
rem filter maximised windows
cmdow | findstr /r /c:"^[^ ]
[ ][^ ][ ][^ ][ ]Max"
rem filter active window
cmdow | findstr /r /c:"^[^ ][ ][^ ][ ][^ ][ ][^ ][ ]Act"
rem filter disabled windows
cmdow | findstr /r /c:"^[^ ][ ][^ ][ ][^ ][ ][^ ][ ][^ ][ ]Dis"
rem filter visible windows
cmdow | findstr /r /c:"^[^ ]
[ ][^ ][ ][^ ][ ][^ ][ ][^ ][ ][^][ ]Vis"
rem filter explorer.exe windows
cmdow | findstr /r /c:"^[^ ]
[ ][^ ][ ][^ ][ ][^ ][ ][^ ][ ][^][ ][^ ][ ]explorer"
rem filter level 4 windowsfor /f "tokens=1-8_" %%a in ('cmdow') do (
if "%%b" EQU "4" echo %%a %%b %%c %%d %%e %%f %%g %%h %%i
)
rem filter visible level 2 windowsfor /f "tokens=1-8_" %%a in ('cmdow') do (
if "%%b" EQU "2" if "%%g" EQU "Vis" echo %%a %%b %%c %%d %%e %%f %%g %%h %%i
)
rem filter visible windows wider than 1000for /f "tokens=1-12*" %%a in ('cmdow /p') do (
if "%%g" EQU "Vis" if %%j GTR 1000 echo %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m
)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADUBULGDLZo2Yo-tPsZsFWOjcWOtYL_ks5qusjOgaJpZM4KHh2W
.

Perhaps you could add these examples to the documentation.