Jump to content

how do i hide/show/minimize all existance of a window?


Recommended Posts

I have multiple windows of opera, I have made a program that should hide opera, but it will hide only the active window, how do i hide/show/minimize all instances of the program?

if ProcessExists("opera.exe) Then

opt ("WinTitleMatchMode", 2)

WinSetState ("opera", "", @SW_HIDE)

Endif

if ProcessExists("opera.exe") Then

opt ("WinTitleMatchMode", 2)

WinSetState ("opera", "", @SW_SHOW)

Endif

if ProcessExists("opera.exe) Then

opt ("WinTitleMatchMode", 2)

WinSetState ("opera", "", @SW_MINIMIZE)

Endif

Link to comment
Share on other sites

I don't have Opera, but if i have a partial of the title wrong then just change that

Here's an Example of the Hide/Show

opt ("WinTitleMatchMode", 2)
$win_title = "Opera"

; hide the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_HIDE)
Next

; show the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_SHOW)
Next
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Hey, thanks again :geek:

for future references.. here's a working script as an example..

#include <GUIConstants.au3>
#NoTrayIcon
Opt ("RunErrorsFatal", 0 )
Global $Paused
HotKeySet("{ESC}", "Terminate")
Func Terminate()
    Exit 0
EndFunc
GuiCreate("Hide/Show 0pera", 280, 80,-1, -1, -1, $WS_EX_TOPMOST)
;== Small label ==;
$Group_1 = GuiCtrlCreateGroup("Hide/Show Opera", 10, 10, 260, 60)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide Opera
$Button1 = GuiCtrlCreateButton("Hide Opera", 30, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Show Opera
$Button2 = GuiCtrlCreateButton("Show Opera", 140, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide window
opt ("WinTitleMatchMode", 2)
$win_title = "Opera"

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
     Case $msg = $GUI_EVENT_CLOSE
       exitloop
       
       
    ;Hide
;==========================>   
     Case $msg = $button1
; hide the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_HIDE)
Next

;Show
;==========================>
Case $msg = $button2
    
; show the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_SHOW)
next

#cs =comment
;Minimize (disabled)
;==========================>
Case $msg = $button2
    
; show the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_MINIMIZE)
next
#ce


endselect
Wend

:o

Edited by slightly_abnormal
Link to comment
Share on other sites

hey, do you know how i can get this to use one button two functions?

#include <GUIConstants.au3>
#NoTrayIcon
Opt ("RunErrorsFatal", 0 )
Global $Paused
HotKeySet("{ESC}", "Terminate")
Func Terminate()
    Exit 0
EndFunc
GuiCreate("Control 0pera", 280, 80,-1, -1, -1, $WS_EX_TOPMOST)
;== Small label ==;
$Group_1 = GuiCtrlCreateGroup("Control Opera", 10, 10, 260, 60)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide Opera
$Button1 = GuiCtrlCreateButton("Hide/Show Opera", 30, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Show Opera
$Button2 = GuiCtrlCreateButton("Min/Res Opera", 140, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide window
opt ("WinTitleMatchMode", 2)
$win_title = "Opera"

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
     Case $msg = $GUI_EVENT_CLOSE
       exitloop
       
       
;Hide/Show
;==========================>   
     Case $msg = $button1
; hide the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_HIDE)

Next

$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_SHOW)
Next


;Minimize/Restore
;==========================>
Case $msg = $button2
    
; show the windows
$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_MINIMIZE)
next

$wlist = WinList($win_title)

For $x = 1 To $wlist[0][0]
    WinSetState($wlist[$x][0],'',@SW_RESTORE)
    Next
endselect
Wend
Link to comment
Share on other sites

not tested:

#include <GUIConstants.au3>
#NoTrayIcon
Opt("RunErrorsFatal", 0)
Global $Paused, $toggle_hide = 1, $toggle_min = 1, $hide_flag = @SW_HIDE, $min_flag = @SW_MINIMIZE

HotKeySet("{ESC}", "Terminate")


GUICreate("Control 0pera", 280, 80, -1, -1, -1, $WS_EX_TOPMOST)
;== Small label ==;
$Group_1 = GUICtrlCreateGroup("Control Opera", 10, 10, 260, 60)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide Opera
$Button1 = GUICtrlCreateButton("Hide/Show Opera", 30, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Show Opera
$Button2 = GUICtrlCreateButton("Min/Res Opera", 140, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide window
Opt("WinTitleMatchMode", 2)
$win_title = "Opera"

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
            
        ;Hide/Show
        ;==========================>
        Case $msg = $Button1
        ; hide the windows
            $wlist = WinList($win_title)
            If $toggle_hide Then
                $hide_flag = @SW_HIDE
            Else
                $hide_flag = @SW_SHOW
            EndIf
            For $x = 1 To $wlist[0][0]
                WinSetState($wlist[$x][0], '', $hide_flag)
                
            Next
            $toggle_hide = Not $toggle_hide
            
            
        ;Minimize/Restore
        ;==========================>
        Case $msg = $Button2
            
        ; show the windows
            $wlist = WinList($win_title)
            If $toggle_min Then
                $min_flag = @SW_MINIMIZE
            Else
                $min_flag = @SW_RESTORE
            EndIf
            For $x = 1 To $wlist[0][0]
                WinSetState($wlist[$x][0], '', $min_flag)
            Next
            $toggle_min = Not $toggle_min
    EndSelect
WEnd

Func Terminate()
    Exit 0
EndFunc  ;==>Terminate
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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