Gui Posted January 24, 2010 Share Posted January 24, 2010 (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 January 24, 2010 by Gui Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 24, 2010 Share Posted January 24, 2010 This might work, I haven't tested it yet.. $state = WinGetState ($Form1) If NOT BitAND($state, 2) Then GUISetState(@SW_RESTORE) Sleep(2500) EndIf - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Gui Posted January 24, 2010 Author Share Posted January 24, 2010 This might work, I haven't tested it yet.. $state = WinGetState ($Form1) If NOT BitAND($state, 2) Then GUISetState(@SW_RESTORE) Sleep(2500) EndIf Thanks for the help! Didn't think of that. Sorry but it didn't work. : ( Thanks though! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted January 24, 2010 Share Posted January 24, 2010 Hmm. Oh well. I might have a use for something like this, but I can't do anything right now. If I come up with something later, I'll post some code that actually works! - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
martin Posted January 24, 2010 Share Posted January 24, 2010 (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 January 24, 2010 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. Link to comment Share on other sites More sharing options...
Gui Posted January 24, 2010 Author Share Posted January 24, 2010 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 ? 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. ) Link to comment Share on other sites More sharing options...
picea892 Posted January 24, 2010 Share Posted January 24, 2010 #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 Link to comment Share on other sites More sharing options...
Gui Posted January 24, 2010 Author Share Posted January 24, 2010 #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! Link to comment Share on other sites More sharing options...
martin Posted January 24, 2010 Share Posted January 24, 2010 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now