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 Get the Paths of All Open Explorer Windows?

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



Joined: 13 Jan 2008
Posts: 115

PostPosted: Sun Feb 28, 2010 4:28 pm    Post subject: How to Get the Paths of All Open Explorer Windows? Reply with quote

Does someone have a trick for this? I bet there must be a clever way of doing this I just don't see.
Back to top
View user's profile Send private message Visit poster's website
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Sun Feb 28, 2010 5:23 pm    Post subject: Reply with quote

I did it as 2 loops just to make it easier to read, but it could easily be done as 1.

Code:
^A::
WinGet, id, list,,
count:=
Loop, %id%
  {
  window := id%A_Index%
  WinGetTitle, title, ahk_id %window%
  window%A_Index%=%title%
  count++
  }
Loop, %count%
  {
  show:=window%A_index%
  MsgBox, Window%A_index% is:`n`n%show%
  }
Return


Paths......damn misread it.....just woke up. Sigh.


Last edited by jl34567 on Sun Feb 28, 2010 5:33 pm; edited 3 times in total
Back to top
View user's profile Send private message AIM Address
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Sun Feb 28, 2010 5:24 pm    Post subject: Reply with quote

Try this:

Code:
SetTitleMode, RegEx
match:="ahk_class (?:Cabinet|Explore)WClass"
WinGet, wList, List, %match%
Loop % wList {
  ControlGetText, wPath, Edit1, % "ahk_id " wList%A_Index%
  res.=((A_Index=1) ? "" : "`n") wPath
}
MsgBox % res
return

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
instantrunoff



Joined: 13 Jan 2008
Posts: 115

PostPosted: Mon Mar 22, 2010 10:47 pm    Post subject: Reply with quote

sinkfaze wrote:
Try this:

Code:
SetTitleMode, RegEx
match:="ahk_class (?:Cabinet|Explore)WClass"
WinGet, wList, List, %match%
Loop % wList {
  ControlGetText, wPath, Edit1, % "ahk_id " wList%A_Index%
  res.=((A_Index=1) ? "" : "`n") wPath
}
MsgBox % res
return


I had to do the following to get it to work on Windows 7. A DllCall would probably be more reliable, but they are beyond me.

Code:
SetTitleMatchMode, RegEx
match:="ahk_class (?:Cabinet|Explore)WClass"
WinGet, wList, List, %match%
Loop % wList {
   WinGetText, wintxt, % "ahk_id " wList%A_Index%
   StringGetPos, ret, wintxt, `r`n
   wPath := SubStr(wintxt, 10, ret - 9)
;  ControlGetText, wPath, Edit1, % "ahk_id " wList%A_Index%
  res.=((A_Index=1) ? "" : "`n") wPath
}
MsgBox % res
Back to top
View user's profile Send private message Visit poster's website
instantrunoff



Joined: 13 Jan 2008
Posts: 115

PostPosted: Mon Mar 22, 2010 11:35 pm    Post subject: Reply with quote

jl34567 wrote:
I did it as 2 loops just to make it easier to read, but it could easily be done as 1.

Code:
^A::
WinGet, id, list,,
count:=
Loop, %id%
  {
  window := id%A_Index%
  WinGetTitle, title, ahk_id %window%
  window%A_Index%=%title%
  count++
  }
Loop, %count%
  {
  show:=window%A_index%
  MsgBox, Window%A_index% is:`n`n%show%
  }
Return


Paths......damn misread it.....just woke up. Sigh.


Thanks but this only works if the path is the title of the window, and it might not be depending on what is set in Folder Options (especially Windows Vista & 7).
Back to top
View user's profile Send private message Visit poster's website
a_h_k



Joined: 02 Feb 2008
Posts: 627

PostPosted: Tue Mar 23, 2010 12:18 am    Post subject: Reply with quote

Take a look at these, they may help...
--> Get the current path of a Window Explorer
--> How can retrieve the directory path of the active window app
Back to top
View user's profile Send private message Visit poster's website
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Tue Mar 23, 2010 12:33 am    Post subject: Reply with quote

Here's an example using COM ( AutoHotkey_L & COM_L ):
Code:
Loop, % ( win:=COM_CreateObject("Shell.Application").Windows ).Count
   If Not InStr( ( exp:=win.item[ A_Index-1 ] ).fullName, "iexplore.exe" )
      MsgBox, % LTrim( RegExReplace( exp.locationURL, "%20", " " ), "file:///" )
Thought this might be simpler than DllCalls Wink .
_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
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