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 

I want to be able to search all windows for schedule task

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






PostPosted: Fri Nov 03, 2006 5:57 pm    Post subject: I want to be able to search all windows for schedule task Reply with quote

I run a scheduled ahk task at the end of the day. Prior to running, it closes out any window titles which match the wintitle name of the process (so as to not ruin the sequence...ie. login, then do a,b,c,etc...)

However, searching merely by wintitle is both inefficient and sometimes inaccurate. You may close and e-mail that has the specified search text closed by accident.

So in this case I would like to first search by process name first, Then cycle through all the wintitles in that process to close out those windows only. This ensure I don't close the wrong type of window by accident.

For this example let's say I want to close out all websites with a wintitle of "msn.com" in process name <IEXPLORE.EXE> (Literal process name for any internet app).

How would I code this?

Thanks in advance.
Back to top
Terrapin



Joined: 15 Aug 2005
Posts: 107
Location: North Carolina

PostPosted: Sat Nov 04, 2006 2:35 pm    Post subject: Reply with quote

I think you would:

Code:
WinGet, WinList, List
Loop, %WinList%
{
  Hwnd := WinList%a_Index%
  WinGet, ProcName, ProcessName, ahk_id %Hwnd%
  MsgBox, %ProcName%
}
return


That's an example which shows the processname for all visible windows (assuming you have the default "detecthiddenwindows, off"). You can compare instead of using msgbox.

If you do know part of the window title you want, in the first line, the 3rd parameter can be that. It must be correct case and SetTitleMatchMode must be set correctly.

So, the way I know to do it would require searching windows first, then processes... I noticed you have in bold, searching processes first.

Hope that helps,

Bob
Back to top
View user's profile Send private message
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