 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Fry
Joined: 01 Nov 2007 Posts: 609
|
Posted: Sun May 04, 2008 5:23 pm Post subject: Getting All Data Out Of A Listview |
|
|
I am trying to get all data out of a listview.
Heres what my listview would look like
| Code: | Name|Extension|Directory
__________________________________
AHK.ahk|ahk|C:\Blah
txt.txt|txt|D:\blah
___________________________________ |
I would like to extract all of that information and append it to a text file.
But in this format
Name|Extension|Directory
or another example
Ahk.ahk|ahk|C:\Blah
Thanks _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
Oberon
Joined: 18 Feb 2008 Posts: 458
|
Posted: Sun May 04, 2008 5:45 pm Post subject: |
|
|
| See the example for LV_GetNext() |
|
| Back to top |
|
 |
skwire
Joined: 18 Jan 2006 Posts: 132 Location: Conway, Arkansas
|
Posted: Sun May 04, 2008 6:18 pm Post subject: |
|
|
Consider the following example:
| Code: | Gui, Add, Listview, xm ym+10 w200 h100 Grid vmyListview , Name|Extension|Directory
Gui, Add, Button , xm+10 ym+115 w180 h20 gDo, Get list data
; Populate list with some data bits.
LV_Add( 1, "AHK.ahk", "ahk", "C:\Blah" )
LV_Add( 2, "txt.txt", "txt", "D:\Blah" )
Gui +LastFound
GUI_ID := WinExist() ; Handle to the GUI
Gui, Show, AutoSize
Return
Do:
{
Gui, Listview, myListview ; Assure we work on the correct listview.
Loop, % LV_GetCount( "Col" ) ; Loop for however many columns are in the listview.
{
LV_GetText( myHeader, 0, A_INDEX ) ; Get column header.
Header_Line .= myHeader . "|" ; Build output data.
}
StringTrimRight, Header_Line, Header_Line, 1 ; Trim trailing pipe char.
ControlGet, List, List, , SysListView321, ahk_id %GUI_ID% ;
StringReplace, List, List, %A_Tab%, |, All
MsgBox, % Header_Line . "`n" . List
}
Return
GuiEscape:
GuiClose:
{
ExitApp
}
Return |
|
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 609
|
Posted: Sun May 04, 2008 8:32 pm Post subject: |
|
|
Thanks skwire but if you click the button once it works fine.
then click it again you get this
Name|Extension|DirectoryName|Extension|Directory _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
Ian
Joined: 15 Jul 2007 Posts: 1157 Location: Enterprise, Alabama
|
Posted: Sun May 04, 2008 8:47 pm Post subject: |
|
|
| Code: | Gui, Add, Listview, xm ym+10 w200 h100 Grid vmyListview , Name|Extension|Directory
Gui, Add, Button , xm+10 ym+115 w180 h20 gDo, Get list data
; Populate list with some data bits.
LV_Add( 1, "AHK.ahk", "ahk", "C:\Blah" )
LV_Add( 2, "txt.txt", "txt", "D:\Blah" )
Gui +LastFound
GUI_ID := WinExist() ; Handle to the GUI
Gui, Show, AutoSize
Return
Do:
Header_Line = ; Make sure Header_Line variable is clear
List = ; Make sure List variable is clear.
Gui, Listview, myListview ; Assure we work on the correct listview.
Loop, % LV_GetCount( "Col" ) ; Loop for however many columns are in the listview.
{
LV_GetText( myHeader, 0, A_INDEX ) ; Get column header.
Header_Line .= myHeader . "|" ; Build output data.
}
StringTrimRight, Header_Line, Header_Line, 1 ; Trim trailing pipe char.
ControlGet, List, List, , SysListView321, ahk_id %GUI_ID% ;
StringReplace, List, List, %A_Tab%, |, All
MsgBox, % Header_Line . "`n" . List
Return
GuiEscape:
GuiClose:
ExitApp
Return |
_________________ ScriptPad/~dieom/dieom/izwian2k7/Trikster/God
 |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 609
|
Posted: Sun May 04, 2008 8:56 pm Post subject: |
|
|
Thanks Ian. _________________ check out my site
www.eliteknifesquad.com |
|
| 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
|