Jump to content

Minimize all windows but AU3 script


Ebola57
 Share

Recommended Posts

Hi community

Is there a way to minimize all active Windows BUT the AU3 running script ?

Tried this without success

WinMinimizeAll ( )
$hWnd = WinGetHandle ( "My_AU3_To_Keep" )

; Does not work
WinSetState ( $hWnd , "", @SW_RESTORE )
    
; Does not work
WinActivate ( $hWnd )

; Does not work
_WinAPI_SetForegroundWindow ( $hWnd )
_WinAPI_SetActiveWindow ( $hWnd )
_WinAPI_SwitchToThisWindow ( $hWnd )

WinGetState of my AU3 is 23 ( $WIN_STATE_MINIMIZED + $WIN_STATE_ENABLED + $WIN_STATE_VISIBLE + $WIN_STATE_EXISTS )

Regards

Edited by Ebola57
Link to comment
Share on other sites

It looks like going in minimized state take "some time", and I can't send an immediate restore call after minimizing

This dirty code patch the problem, but can't imagine there's nothing better to do ...

$hWnd = WinGetHandle ( "My_AU3_To_Keep" )
WinMnimizeAll ( )
While 1
    If $WinGetState ( $hWnd ) == 23 Then 
        WinActivate ( $hWnd )
        ExitLoop
    EndIf
WEnd

 

Edited by Ebola57
Link to comment
Share on other sites

Seems that you need a small sleep in your script...

WinMinimizeAll()
Sleep(100)
WinSetState($hWnd, "", @SW_RESTORE)

 

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

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...