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 

Activate only when Desktop has focus

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Renfro



Joined: 06 Jul 2008
Posts: 22

PostPosted: Sat Oct 03, 2009 9:26 pm    Post subject: Activate only when Desktop has focus Reply with quote

How can I ensure that a particular action only runs when the Desktop has focus?

I used Window Spy and clicked on the Desktop to get the window title and class (Program Manager & ahk_class Progman) but when I use these values

e.g.

Code:
IfWinActive, ahk_class Progman


it applies to all Explorer windows and is not restricted to the Desktop.

Thanks
Back to top
View user's profile Send private message
Roland



Joined: 08 Jun 2006
Posts: 307

PostPosted: Sat Oct 03, 2009 9:58 pm    Post subject: Reply with quote

Use the window title? I.e.

Code:
IfWinActive Program Manager ahk_class Progman
Back to top
View user's profile Send private message
Renfro



Joined: 06 Jul 2008
Posts: 22

PostPosted: Sat Oct 03, 2009 11:09 pm    Post subject: Reply with quote

Embarassed

I can't believe it was that simple.

Thanks!
Back to top
View user's profile Send private message
Renfro



Joined: 06 Jul 2008
Posts: 22

PostPosted: Sat Oct 03, 2009 11:14 pm    Post subject: Reply with quote

I think I knew where my confusion came from.

I had another script running (with no icon) that was performing the same function (in a different way) in Explorer windows. This made it appear as if the Desktop and Explorer windows were being treated as one (when in fact it was actually 2 separate scripts each operating on a different area).
Back to top
View user's profile Send private message
Renfro



Joined: 06 Jul 2008
Posts: 22

PostPosted: Sun Oct 04, 2009 12:51 am    Post subject: Reply with quote

I have another question relating to the above topic:

How can I prevent the script from running if focus is on a Desktop icon (as opposed to the Desktop itself)?

the command IfWinActive Program Manager ahk_class Progman does not distinguish between the Desktop and icons that are on the Desktop.
Back to top
View user's profile Send private message
Renfro



Joined: 06 Jul 2008
Posts: 22

PostPosted: Fri Oct 09, 2009 12:32 am    Post subject: Reply with quote

Can anyone help with the question that I asked above?

Quote:
How can I prevent the script from running if focus is on a Desktop icon (as opposed to the Desktop itself)?


Thanks!

Smile
Back to top
View user's profile Send private message
Display posts from previous:   
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