AutoHotkey Community

It is currently May 27th, 2012, 3:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: February 28th, 2010, 5:28 pm 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
Does someone have a trick for this? I bet there must be a clever way of doing this I just don't see.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2010, 6:23 pm 
Offline

Joined: January 3rd, 2010, 6:33 am
Posts: 262
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 February 28th, 2010, 6:33 pm, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2010, 6:24 pm 
Offline
User avatar

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

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 22nd, 2010, 11:47 pm 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 12:35 am 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 1:18 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 1:33 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
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: .

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn and 27 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