AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to sense that all open windows are minimized?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
klbatbcl
Guest





PostPosted: Sun Nov 22, 2009 12:22 am    Post subject: How to sense that all open windows are minimized? Reply with quote

I need a script that tests whether all open windows are minimized / the user is looking at the Desktop.

If yes, I want to:

SendInput #{m} ; To put the mouse focus on the current Desktop icon.

If no, do nothing.

Any help would be appreciated .. thx.

KLB
Back to top
sinkfaze



Joined: 18 Mar 2008
Posts: 2428

PostPosted: Sun Nov 22, 2009 12:30 am    Post subject: Reply with quote

From here, will test what window is under the mouse:

Code:
MouseGetPos,,,win
WinGetClass, class, ahk_id %win%
If class in Progman,WorkerW
 MsgBox, You're on the Desktop!
else
 MsgBox, You're so not on the Desktop!
Return

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
klbatbcl
Guest





PostPosted: Sun Nov 22, 2009 12:58 am    Post subject: How to sense that all open windows are minimized? Reply with quote

Didn't quite work ..

With two open windows, I closed the first, ran the test and it minimized the second window, which should have been left open.

Any way to use a WinActive test?

Thanks,
KLB
Back to top
jaco0646



Joined: 07 Oct 2006
Posts: 1770
Location: MN, USA

PostPosted: Sun Nov 22, 2009 3:07 am    Post subject: Reply with quote

This literally checks each window to determine if it is minimized.
Code:
#z::
WinGet, list, List
Loop,% list {
 WinGet, state, MinMax,% "ahk_id" list%A_Index%
 If (state != -1) {
  WinGetClass, class,% "ahk_id" list%A_Index%
  If class not in Progman,WorkerW,Shell_TrayWnd
  {
   MsgBox,% class "`tis not minimized."
   return
  }
 }
}
SendInput, {F4}
return

_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
sinkfaze



Joined: 18 Mar 2008
Posts: 2428

PostPosted: Sun Nov 22, 2009 4:13 am    Post subject: Re: How to sense that all open windows are minimized? Reply with quote

klbatbcl wrote:
With two open windows, I closed the first, ran the test and it minimized the second window, which should have been left open.


Hopefully you realize that there's no WinMinimize command in the code I posted, so I don't think it's possible the code I posted did that unless you modified it, in which case we need to see your code.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message
klbatbcl
Guest





PostPosted: Sun Nov 22, 2009 11:42 am    Post subject: How to sense that all open windows are minimized? Reply with quote

Thank you for the code! My script is still not working every time the way I want it to, but now I'm into / learning AHK and running some tests.

KLB
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group