Jump to content

Minimizing windows


Recommended Posts

Hey all,

Ive tried the help file. but ive come up with no luck.

Im trying to minimize multiple windows of the same name.

So say I have 5 firefox windows open. And 3 of them are just the starting page. I wanna minimize all 3 that are on the starting page. But keep the other 2 open as then will be on different websites so will have different titles.

#include-once

Func MinWindowByClass($Classname)

    If WinExists($Classname) Then
        Return 1
    Else
        Return WinSetState("[CLASS:" & $Classname & "]", "", @SW_MINIMIZE)
    EndIf

EndFunc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#include <..\Library\Minimize specific window.au3>

Func Test_MinSpecWin()

    local $Classname = "MozillaWindowClass"

    MinWindowByClass($Classname)

    local $state = WinGetState("[CLASS:" & $Classname & "]")

    if BitAND($state, 16) then
        return 1
    Else
        return 0
    endif

EndFunc
Link to comment
Share on other sites

pick your poison:

$aWindows = WinList("[CLASS:AcrobatSDIWindow]")
For $i = 1 To UBound($aWindows)-1
   If Not BitAND(WinGetState($aWindows[$i][1]), 16) Then WinSetState ($aWindows[$i][1], "", @SW_MINIMIZE)
Next

$iCounter = 1
$hwnd = WinGetHandle("[CLASS:AcrobatSDIWindow; INSTANCE:" & $iCounter & "]")
While IsHWnd($hwnd)
 If Not BitAND(WinGetState($hwnd), 16) Then WinSetState ($hwnd, "", @SW_MINIMIZE)
 $iCounter+=1
 $hwnd = WinGetHandle("[CLASS:AcrobatSDIWindow; INSTANCE:" & $iCounter & "]")
WEnd
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Oh, only half read your need...you can add TITLE:|REGEXPTITLE: into the []:

Or, add an additional step in each loop...WinGetTitle, and check if it matches your string...else skip the minimize

  • TITLE - Window title
  • CLASS - The internal window classname
  • REGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2)
  • REGEXPCLASS - Window classname using a regular expression (if the regular expression is wrong @error will be set to 2)
  • LAST - Last window used in a previous AutoIt command
  • ACTIVE - Currently active window
  • X Y W H - The position and size of a window
  • INSTANCE - The 1-based instance when all given properties match
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Oh, only half read your need...you can add TITLE:|REGEXPTITLE: into the []:

Or, add an additional step in each loop...WinGetTitle, and check if it matches your string...else skip the minimize

  • TITLE - Window title
  • CLASS - The internal window classname
  • REGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2)
  • REGEXPCLASS - Window classname using a regular expression (if the regular expression is wrong @error will be set to 2)
  • LAST - Last window used in a previous AutoIt command
  • ACTIVE - Currently active window
  • X Y W H - The position and size of a window
  • INSTANCE - The 1-based instance when all given properties match
I knew I had to loop it somehow just wasnt sure what way to go about it.
Link to comment
Share on other sites

Oh, only half read your need...you can add TITLE:|REGEXPTITLE: into the []:

Or, add an additional step in each loop...WinGetTitle, and check if it matches your string...else skip the minimize

  • TITLE - Window title
  • CLASS - The internal window classname
  • REGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2)
  • REGEXPCLASS - Window classname using a regular expression (if the regular expression is wrong @error will be set to 2)
  • LAST - Last window used in a previous AutoIt command
  • ACTIVE - Currently active window
  • X Y W H - The position and size of a window
  • INSTANCE - The 1-based instance when all given properties match

like this?

$aWindows = WinList("[CLASS:|REGEXPCLASS" & $Classname & "]")
Edited by olo
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...