 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
instantrunoff
Joined: 13 Jan 2008 Posts: 115
|
Posted: Sun Feb 28, 2010 4:28 pm Post subject: How to Get the Paths of All Open Explorer Windows? |
|
|
| 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 |
|
 |
jl34567
Joined: 03 Jan 2010 Posts: 262
|
Posted: Sun Feb 28, 2010 5:23 pm Post subject: |
|
|
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 |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Sun Feb 28, 2010 5:24 pm Post subject: |
|
|
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 |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 115
|
Posted: Mon Mar 22, 2010 10:47 pm Post subject: |
|
|
| 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 |
|
 |
instantrunoff
Joined: 13 Jan 2008 Posts: 115
|
Posted: Mon Mar 22, 2010 11:35 pm Post subject: |
|
|
| 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 |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 627
|
|
| Back to top |
|
 |
jethrow
Joined: 24 May 2009 Posts: 1907 Location: Iowa, USA
|
Posted: Tue Mar 23, 2010 12:33 am Post subject: |
|
|
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 . _________________
- in case I forgot to smile
Basic Webpage Controls
COM Object Reference |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|