Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_GUICtrlListView_CreateArray() - Create an array from a ListView.

listview array

  • Please log in to reply
21 replies to this topic

#1 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 25 May 2011 - 03:32 PM

For those who use ListViews and wish to call a Function to grab the contents of the ListView into a 2D array, then _GUICtrlListView_CreateArray() is for you. It will Return an array with the contents of the ListView inc. the number of rows, columns & column names. Simply run the Example to get an idea of the output. Thanks.

Function:
AutoIt         
; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUICtrlListView_CreateArray ; Description ...: Creates a 2-dimensional array from a listview. ; Syntax ........: _GUICtrlListView_CreateArray($hListView[, $sDelimeter = '|']) ; Parameters ....: $hListView           - Control ID/Handle to the control ;                  $sDelimeter          - [optional] One or more characters to use as delimiters (case sensitive). Default is '|'. ; Return values .: Success - The array returned is two-dimensional and is made up of the following: ;                                $aArray[0][0] = Number of rows ;                                $aArray[0][1] = Number of columns ;                                $aArray[0][2] = Delimited string of the column name(s) e.g. Column 1|Column 2|Column 3|Column nth ;                                $aArray[1][0] = 1st row, 1st column ;                                $aArray[1][1] = 1st row, 2nd column ;                                $aArray[1][2] = 1st row, 3rd column ;                                $aArray[n][0] = nth row, 1st column ;                                $aArray[n][1] = nth row, 2nd column ;                                $aArray[n][2] = nth row, 3rd column ; Author ........: guinness ; Remarks .......: GUICtrlListView.au3 should be included. ; Example .......: Yes ; =============================================================================================================================== Func _GUICtrlListView_CreateArray($hListView, $sDelimeter = '|')     Local $iColumnCount = _GUICtrlListView_GetColumnCount($hListView), $iDim = 0, $iItemCount = _GUICtrlListView_GetItemCount($hListView)     If $iColumnCount < 3 Then         $iDim = 3 - $iColumnCount     EndIf     If $sDelimeter = Default Then         $sDelimeter = '|'     EndIf     Local $aColumns = 0, $aReturn[$iItemCount + 1][$iColumnCount + $iDim] = [[$iItemCount, $iColumnCount, '']]     For $i = 0 To $iColumnCount - 1         $aColumns = _GUICtrlListView_GetColumn($hListView, $i)         $aReturn[0][2] &= $aColumns[5] & $sDelimeter     Next     $aReturn[0][2] = StringTrimRight($aReturn[0][2], StringLen($sDelimeter))     For $i = 0 To $iItemCount - 1         For $j = 0 To $iColumnCount - 1             $aReturn[$i + 1][$j] = _GUICtrlListView_GetItemText($hListView, $i, $j)         Next     Next     Return SetError(Number($aReturn[0][0] = 0), 0, $aReturn) EndFunc   ;==>_GUICtrlListView_CreateArray
Example use of Function:
AutoIt         
#include <Array.au3> ; Required only for _ArrayDisplay(). #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <WindowsConstants.au3> Example() Func Example()     Local $iWidth = 600, $iHeight = 400, $iListView = 0     Local $hGUI = GUICreate('_GUICtrlListView_CreateArray()', $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))     _CreateListView($hGUI, $iListView)     Local $iGetArray = GUICtrlCreateButton('Get Array', $iWidth - 90, $iHeight - 28, 85, 25)     GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)     Local $iRefresh = GUICtrlCreateButton('Refresh', $iWidth - 180, $iHeight - 28, 85, 25)     GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)     GUISetState(@SW_SHOW, $hGUI)     Local $aReturn = 0, $aStringSplit = 0     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 ExitLoop             Case $iGetArray                 $aReturn = _GUICtrlListView_CreateArray($iListView, Default) ; Use | as the default delimeter.                 _ArrayDisplay($aReturn, '_GUICtrlListView_CreateArray() array.')                 $aStringSplit = StringSplit($aReturn[0][2], '|')                 _ArrayDisplay($aStringSplit, 'StringSplit() to retrieve column names.')             Case $iRefresh                 GUICtrlDelete($iListView)                 _CreateListView($hGUI, $iListView)         EndSwitch     WEnd     GUIDelete($hGUI) EndFunc   ;==>Example Func _CreateListView($hGUI, ByRef $iListView) ; Thanks to AZJIO for this function.     Local $aClientSize = WinGetClientSize($hGUI)     $iListView = GUICtrlCreateListView('', 0, 0, $aClientSize[0], $aClientSize[1] - 30)     GUICtrlSetResizing($iListView, $GUI_DOCKBORDERS)     Sleep(250)     Local $iColumns = Random(1, 5, 1)     __ListViewFill($iListView, $iColumns, Random(25, 100, 1)) ; Fill the ListView with Random data.     For $i = 0 To $iColumns         _GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE)         _GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE_USEHEADER)     Next EndFunc   ;==>_CreateListView Func __ListViewFill($hListView, $iColumns, $iRows) ; Required only for the Example.     If Not IsHWnd($hListView) Then         $hListView = GUICtrlGetHandle($hListView)     EndIf     Local $fIsCheckboxesStyle = (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES)     _GUICtrlListView_BeginUpdate($hListView)     For $i = 0 To $iColumns - 1         _GUICtrlListView_InsertColumn($hListView, $i, 'Column ' & $i + 1, 50)         _GUICtrlListView_SetColumnWidth($hListView, $i - 1, -2)     Next     For $i = 0 To $iRows - 1         _GUICtrlListView_AddItem($hListView, 'Row ' & $i + 1 & ': Col 1', $i)         If Random(0, 1, 1) And $fIsCheckboxesStyle Then             _GUICtrlListView_SetItemChecked($hListView, $i)         EndIf         For $j = 1 To $iColumns             _GUICtrlListView_AddSubItem($hListView, $i, 'Row ' & $i + 1 & ': Col ' & $j + 1, $j)         Next     Next     _GUICtrlListView_EndUpdate($hListView) EndFunc   ;==>__ListViewFill

Edited by guinness, 18 July 2013 - 01:36 PM.

  • JScript likes this

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014








#2 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 21,141 posts

Posted 26 May 2011 - 10:31 AM

guinness,

Nice. :huh2:

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#3 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 26 May 2011 - 10:35 AM

Thank Melba :huh2:

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#4 spudw2k

spudw2k

    passionately misinformed

  • Active Members
  • PipPipPipPipPipPip
  • 1,279 posts

Posted 13 November 2011 - 05:14 PM

guinness,

I was just looking through you signature (after reading a recent post you replied to) and found this topic. I also made a function to do the same thing. Upon examining and comparing our methods it seems the only real differences are my function doesn't have error checking and I dynamically build the array instead of initial size declaration. Less the error checking, I assume declaring the array size initially has better performance than performing a Ubound over and over. Would you agree?

#5 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 13 November 2011 - 05:32 PM

In your example ReDim is the real issue with performance (look at _ReDim in my signature) so since you know the number of rows anyway it's best just to initial the array at the start of the function. I've also read that the larger the array becomes the slower Ubound is, though we're talking ms. Another point is some variables aren't declared in Local scope and you're declaring a variable inside a loop which can affect performance too.

I wonder what the difference in time is? I will check this evening.

Edited by guinness, 13 November 2011 - 08:22 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#6 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 13 November 2011 - 05:39 PM

With 5000 items the results were:

Mine: 1313.33962550961
Yours: 13802.8888616261

Mine: 1404.9440669193
Yours: 13556.6254318947

But on a ListView with 100 it wasn't worth documenting.

Edited by guinness, 14 November 2011 - 12:36 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#7 spudw2k

spudw2k

    passionately misinformed

  • Active Members
  • PipPipPipPipPipPip
  • 1,279 posts

Posted 13 November 2011 - 08:02 PM

Cool, thanks for the knowledge and benchmarks.

#8 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 14 November 2011 - 12:42 AM

No problem, thanks for pointing out your function to me. I remember your project SpeeDBurner come to think of it, believe it or not it was something I used when I started out with AutoIt.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#9 newsman220

newsman220

    Seeker

  • Active Members
  • 14 posts

Posted 07 October 2012 - 04:47 PM

This is fantastic. I'm using ListViews to hold the results of WMI queries, and this is the ideal way to get them out to a spreadsheet. Thanks for giving this to the community!

#10 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 07 October 2012 - 06:58 PM

No problem. Thanks for the compliment.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#11 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,216 posts

Posted 07 October 2012 - 08:27 PM

5 stars from me! Thank you my friend.
:thumbsup:

JS
http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!       


#12 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,584 posts

Posted 08 October 2012 - 01:57 AM

This can be shorter
$sIndex = _GUICtrlListView_GetItemText($hListView, $A) $aReturn[$A + 1][0] = $sIndex


5 stars. Useful thing

Edited by AZJIO, 07 February 2013 - 09:17 AM.


#13 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 08 October 2012 - 08:05 AM

I will optimise the function today as i've learnt a lot in the last year.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#14 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 08 October 2012 - 10:37 AM

I've updated the function as promised and optimised the code greatly. Now there are fewer lines and no more unnecessary variables. See the original post for more details.

Edit: Oh, and the times mentioned in post #6 have been decreased by 120%!

Edited by guinness, 08 October 2012 - 10:43 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#15 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,584 posts

Posted 09 October 2012 - 02:28 AM

AutoIt         
#include <Array.au3> ; Required only for _ArrayDisplay(). #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <WindowsConstants.au3> #include <_GUICtrlListView_CreateArray.au3> Example() Func Example()     Local $iWidth = 600, $iHeight = 400, $iListView     Local $hGUI = GUICreate('_GUICtrlListView_CreateArray()', $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))     _CreateListView($hGUI, $iListView)     Local $iGetArray = GUICtrlCreateButton('Get Array', $iWidth - 120, $iHeight - 28, 115, 27)     GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)     Local $iRefresh = GUICtrlCreateButton('Refresh', $iWidth - 240, $iHeight - 28, 115, 27)     GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKSIZE + $GUI_DOCKBOTTOM)     GUISetState(@SW_SHOW, $hGUI)     Local $aReturn = 0, $aStringSplit = 0     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 ExitLoop             Case $iGetArray                 $aReturn = _GUICtrlListView_CreateArray($iListView, Default) ; Use | as the default delimeter.                 _ArrayDisplay($aReturn, '_GUICtrlListView_CreateArray() array.')                 $aStringSplit = StringSplit($aReturn[0][2], '|')                 _ArrayDisplay($aStringSplit, 'StringSplit() to retrieve column names.')             Case $iRefresh                 GUICtrlDelete($iListView)                 _CreateListView($hGUI, $iListView)         EndSwitch     WEnd     GUIDelete($hGUI) EndFunc Func _CreateListView($hGUI, ByRef $iListView)     $ClientSize = WinGetClientSize($hGUI)     $iListView = GUICtrlCreateListView('', 0, 0, $ClientSize[0], $ClientSize[1] - 30)     GUICtrlSetResizing($iListView, $GUI_DOCKBORDERS)     Sleep(250)     $iCol = Random(1, 5, 1)     __ListViewFill($iListView, $iCol, Random(25, 100, 1)) ; Fill the ListView with Random data.     For $i = 0 To $iCol         GUICtrlSendMsg($iListView, $LVM_SETCOLUMNWIDTH, $i, -1)         GUICtrlSendMsg($iListView, $LVM_SETCOLUMNWIDTH, $i, -2)     Next EndFunc Func __ListViewFill($hListView, $iColumns, $iRows) ; Required only for the Example.     If Not IsHWnd($hListView) Then         $hListView = GUICtrlGetHandle($hListView)     EndIf     Local $fIsCheckboxesStyle = (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES)     _GUICtrlListView_BeginUpdate($hListView)     For $i = 0 To $iColumns - 1         _GUICtrlListView_InsertColumn($hListView, $i, 'Column ' & $i + 1, 50)         _GUICtrlListView_SetColumnWidth($hListView, $i - 1, -2)     Next     For $i = 0 To $iRows - 1         _GUICtrlListView_AddItem($hListView, 'Row ' & $i + 1 & ': Col 1', $i)         If Random(0, 1, 1) And $fIsCheckboxesStyle Then             _GUICtrlListView_SetItemChecked($hListView, $i)         EndIf         For $j = 1 To $iColumns             _GUICtrlListView_AddSubItem($hListView, $i, 'Row ' & $i + 1 & ': Col ' & $j + 1, $j)         Next     Next     _GUICtrlListView_EndUpdate($hListView) EndFunc

Edited by AZJIO, 07 February 2013 - 09:17 AM.


#16 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 09 October 2012 - 09:04 AM

Thanks AZJIO, I updated the example in the first post with your improvement to re-creating the ListView. My version was just a quick 'hack' as I was in a rush to upload the function and example.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#17 Xerix

Xerix

    Seeker

  • Active Members
  • 38 posts

Posted 18 July 2013 - 01:10 PM

Hello,

 

Just a detail in the header of the script.

 

$aArray[0][3] = Delimited string of the column name(s) e.g. Column 1|Column 2|Column 3|Column nth

 

should be

 

$aArray[0][2] = Delimited string of the column name(s) e.g. Column 1|Column 2|Column 3|Column nth

 

Thank you



#18 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,180 posts

Posted 18 July 2013 - 01:30 PM

Funny, I was just thinking about this function and whether I should add it to the UDFs, but that's a different story. Thanks I will fix it.


Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#19 garbb

garbb

    Seeker

  • Active Members
  • 46 posts

Posted 16 April 2014 - 08:48 AM

I was messing around with this and I noticed that replacing

$aReturn[$i + 1][$j] = _GUICtrlListView_GetItemText($hListView, $i, $j)

with

$aReturn[$i + 1][$j] = ControlListView($hGUI, '', $hListView, 'GetText', $i, $j)

seems to speed this up a bit.

 

Unfortunately I could not get it to work without having to put the window handle in there.



#20 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,584 posts

Posted 16 April 2014 - 06:31 PM

http://autoit-script.ru/index.php/topic,12724.15.html

AutoIt         
#include <WinAPI.au3> #include <Array.au3> $hGui = GUICreate('Test', 400, 300) $iListView = GUICtrlCreateListView('Line     |Data', 2, 2, 394, 268) ; $iListView = GUICtrlCreateListView('Line', 2, 2, 394, 268) $hListView = GUICtrlGetHandle(-1) ; $hListView = $iListView For $i = 1 To 1000     GUICtrlCreateListViewItem('Line ' & $i & '|' & Random(1000, 9999, 1), $iListView)     ; GUICtrlCreateListViewItem('Line '&$i, $iListView) Next GUISetState() $hTimer = TimerInit() $aReturn = _GUICtrlListView_GetAllTextToArray($hListView) $extended = @extended If @error < 0 Then Exit MsgBox(0, 'Message', 'List empty') $sTime = Round(TimerDiff($hTimer)) & ' ms' ; MsgBox(262144, 'Information', _ ; "Items: " & _WinAPI_LoWord($extended) & @LF & _ ; "Columns: " & _WinAPI_HiWord($extended)) _ArrayDisplay($aReturn, $sTime) Func _GUICtrlListView_GetAllTextToArray($hListView)     If Not IsHWnd($hListView) Then         $hListView = GUICtrlGetHandle($hListView)         If Not IsHWnd($hListView) Then Return SetError(1, 0, 0)     EndIf     Local $hWin, $iItems, $iSubitems     $hWin = _WinAPI_GetParent($hListView)     If Not $hWin Then Return SetError(2, 0, 0)     $iItems = ControlListView($hWin, '', $hListView, 'GetItemCount')     If Not $iItems Then Return SetError(-1, 0, 0)     $iSubitems = ControlListView($hWin, '', $hListView, 'GetSubItemCount')     ; If Not $iSubitems Then Return SetError(-2, 0, 0)     If Not $iSubitems Then $iSubitems = 1     Local $aReturn[$iItems][$iSubitems] = [[$iItems]]     ; For $i = 0 To $iItems - 1         ; For $j = 0 To $iSubitems - 1             ; $aReturn[$i][$j] = ControlListView($hWin, '', $hListView, 'GetText', $i, $j)         ; Next     ; Next     For $j = 0 To $iSubitems - 1         For $i = 0 To $iItems - 1             $aReturn[$i][$j] = ControlListView($hWin, '', $hListView, 'GetText', $i, $j)         Next     Next     Return SetError(0, _WinAPI_MakeLong($iItems, $iSubitems), $aReturn) EndFunc   ;==>_GUICtrlListView_GetAllTextToArray

Edited by AZJIO, 07 June 2014 - 01:56 PM.

  • garbb likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users