Jump to content

Recommended Posts

Posted (edited)

Aye guys. Just want to know if you could just see if a GUI is hidden overall ( Minimized to Taskbar, or inside the tray.) ; WINGetState , 2 = Window is visable. So I want 'Not 2'

I've tried :

$state = WinGetState ($Form1)   
    If BitAND($state, Not 2) Then  ; Window is Not visable overall. - Doesn't work.
        GUISetState(@SW_RESTORE)
        Sleep(2500)
    EndIf

Would you use BitNOT? Sorry i'm new to Bit___ stuff. Help is appreciated. Thanks!

Regards,

GUI

Edited by Gui
Posted (edited)

Thanks for the help! Didn't think of that. Sorry but it didn't work. : ( Thanks though!

If you want to check if it's minimized then

Run("Notepad.exe")
Sleep(2000)
While 1
    If Not WinExists("Untitled") Then Exit
    $state = WinGetState("Untitled")
    If BitAND($state, 16) Then ; Window is minimized.
        WinSetState("Untitled", "", @SW_RESTORE)
 EndIf

 Sleep(2500)
WEnd
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

If you want to check if it's minimized then

Run("Notepad.exe")
Sleep(2000)
While 1
    If Not WinExists("Untitled") Then Exit
    $state = WinGetState("Untitled")
    If BitAND($state, 16) Then ; Window is minimized.
        WinSetState("Untitled", "", @SW_RESTORE)
        Sleep(2500)
    EndIf
WEnd

Yeah but the thing is, what if it's minimized to tray as well :D? It will only see if it's minimized to task bar. That's why i'm trying to see if it's generally NOT visable. (So it could be minimized or in system tray. :huggles: )
Posted

#Include <WinAPI.au3>
HotKeySet("q","visible")
func visible()
    $pos=WinGetPos("AutoIt Help","")
    if $pos[0]=-32000 or _WinAPI_IsWindowVisible(WinGetHandle("AutoIt Help",""))=0 Then
        ConsoleWrite("can't see me"&@CRLF)
    Else
        ConsoleWrite("Here I am"&@CRLF)
    EndIf
EndFunc
While 1
sleep(100)
WEnd

Posted

#Include <WinAPI.au3>
HotKeySet("q","visible")
func visible()
    $pos=WinGetPos("AutoIt Help","")
    if $pos[0]=-32000 or _WinAPI_IsWindowVisible(WinGetHandle("AutoIt Help",""))=0 Then
        ConsoleWrite("can't see me"&@CRLF)
    Else
        ConsoleWrite("Here I am"&@CRLF)
    EndIf
EndFunc
While 1
sleep(100)
WEnd

Worked beautifully thanks! :D
Posted

You originally asked to know if the window is minimized or in the tray. In the tray might mean the window is hidden but minimized to the task bar does not. So you need to check for both conditions.

Run("Notepad.exe")
Sleep(2000)
winsetstate("Untitled","",@SW_HIDE)
sleep(1000)
While 1
    If Not WinExists("Untitled") Then Exit
    $state = WinGetState("Untitled")
    If BitAND($state, 16) or NOT BitAnd($state,2) Then ; Window is minimized or not visible
        WinSetState("Untitled", "", @SW_SHOW)
        wiNSETSTATE("Untitled", "", @SW_restore)
    EndIf
    Sleep(200)
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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
×
×
  • Create New...