AutoHotkey Community

It is currently May 27th, 2012, 2:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: November 22nd, 2009, 1:22 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 1:30 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
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

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2009, 1:58 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2009, 4:07 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2009, 5:13 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
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.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2009, 12:42 pm 
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


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Google Feedfetcher, rbrtryn and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group