Jump to content

Hiding only those Open Windows shown on taskbar


ali
 Share

Recommended Posts

How can I hide windows that are currently open and showing (basically those that show on the taskbar, and not including those in the background run by the system? Of course the other windows will already be hidden, but then I want to also be able to unhide just those. Here is the code that I currently have, but it hides and also unhides every single window, regardless wether it is shown on the taskbar as active/enabled or already hidden. Basically i want to know how to be able the titles of those windows that are open and show on the taskbar.

E.g. If i have a folder named Scripts, it will show on the taskbar. I want to be able to simply hide that folder and also unhide it later.

If someone can please help me with that, I would much appreciate it and would then be able to figure the rest out.

Code to Hide windows

Dim $winlistxi

Dim $winlistx = WinList()

For $winlistxi = 1 to $winlistx[0][0]

WinSetState($winlistx[$winlistxi][0], "", @SW_HIDE)

Next

Code to Unhide windows

Dim $winlist = WinList()

Dim $winlisti

For $winlisti = 1 to $winlisti[0][0]

WinSetState($winlist[$winlisti][0], "", @SW_SHOW)

Next

Link to comment
Share on other sites

Just so u know the unhide code will unhide every single

True, and this is the actual problem I'm having. I need it to only unhide those windows that were originally shown on the taskbar. How can I check if a window is shown on the taskbar or not?

Link to comment
Share on other sites

just a thought... i donno if this'll work but you could use WinMinimizeAll() and then use WinGetState to hide all minimized windows? so like

i dont know if this'll work

WinMinimizeAll()
$list = WinList()
for $i = 0 to $list[0][0]
$state = WinGetState($list[$][0])
if bitand($state, 16) then
;do hiding stuff here and whatnot
endif
next

--again, not sure if it'll work but you can try it

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

  • Moderators

Just deleted old post, this does in fact work on my system.

Dim $WinArray = ''
HotKeySet('{PGDN}', 'HideTaskBarWindows')
HotKeySet('{PGUP}', 'UnHideTaskBarWindows')

While 1
    Sleep(0x7FFFFFFF)
WEnd

Func HideTaskBarWindows()
    $WinArray = ''
    Local $winlistx = WinList()
    For $winlistxi = 1 to $winlistx[0][0]
        If ControlCommand($winlistx[$winlistxi][0], '', '', 'IsVisible', '') And Not StringInStr($winlistx[$winlistxi][0], 'Program Manager') Then $WinArray = $WinArray & $winlistx[$winlistxi][0] & Chr(01)
    Next
    $WinArray = StringSplit(StringTrimRight($WinArray, 1), Chr(01))
    For $i = 1 To UBound($WinArray) - 1
        ControlHide($WinArray[$i], '', '')
    Next
EndFunc

Func UnHideTaskBarWindows()
    For $i = 1 To UBound($WinArray) - 1
        ControlShow($WinArray[$i], '', '')
    Next
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 7 years later...

Scriptler,

Welcome to the AutoIt Forums. :)

If your just trying to hide one window then you need not concern your self with the above script. It is quite simple just get a handle to the window using WinGetHandle() and then use WinSetState() to hide the window.

$hWin = WinGetHandle("The window's title", "")
WinSetState($hWin, "", @SW_HIDE)

Also I think its better to start new topics rather then to revisit old ones just be sure to take your time when searching before posting.

Spoiler

censored.jpg

 

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...