Earthquake Posted June 28, 2006 Share Posted June 28, 2006 Hi Snipez, I want a script to determine, wheater a window is inactive. After some tests with WinGetState I've got no more ideas... Please give me a little piece of code and I'm happy again. Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene! Link to comment Share on other sites More sharing options...
Valuater Posted June 28, 2006 Share Posted June 28, 2006 almost straight from help If WinActive("Untitled -") Then MsgBox(0, "", "Window was active") Else MsgBox(0, "", "Window was not active") EndIf 8) Link to comment Share on other sites More sharing options...
Somniis Posted June 29, 2006 Share Posted June 29, 2006 Or.. in addition to what Valuater posted... If Not WinActive("Title") Then MsgBox(0, "Title", "Window is not active.") Else MsgBox(0, "Title", "Window is active.") EndIf The same thing, only negated. Link to comment Share on other sites More sharing options...
herewasplato Posted June 29, 2006 Share Posted June 29, 2006 (edited) Run("notepad") WinWait("Untitled -") WinActivate("Untitled -") WinWaitActive("Untitled -") If BitAND(WinGetState("Untitled -"), 8) Then MsgBox(0, "", "Window was active") Else MsgBox(0, "", "Window was not active") EndIf...since you mentioned WinGetState... Edited June 29, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Earthquake Posted June 29, 2006 Author Share Posted June 29, 2006 (edited) Thanks a lot! But I tried this as well... Here's my code: $dif = TimerDiff($begin) If ($dif > 1000) Then CheckforMinimized() EndIf Func CheckforMinimized() $Minimized = WinGetState("Untitled - Notepad", "") If BitAND($Minimized, 8) Then WinSetState("Test","", @SW_SHOW); Test is my script. Else WinSetState("Test","",@SW_HIDE) EndIf EndFunc First I check, whether Notepad is open. If that's true, the script should stay topmost (is definded in another function). But when another program is active, it should hide. But right now, its blinking every second!!! He,he, cool effect, but I want to use this GUI, too! Edited June 29, 2006 by Earthquake Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene! Link to comment Share on other sites More sharing options...
herewasplato Posted June 29, 2006 Share Posted June 29, 2006 While 1 CheckforMinimized() Sleep(1000) WEnd Func CheckforMinimized() $Minimized = WinGetState("Untitled - Notepad", "") If BitAND($Minimized, 16) Then MsgBox(0, "", "mini") If BitAND($Minimized, 8) Then MsgBox(0, "", "active") If $Minimized = 0 Then MsgBox(0, "", "not there") EndFunc ;==>CheckforMinimizedThis works as a stand alone test. I'll have to let others see if they understand the problem with the sample code you posted. [size="1"][font="Arial"].[u].[/u][/font][/size] 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