Jump to content

Modified version of the standard Array.au3 include file


BrewManNH
 Share

Recommended Posts

I have a modified version of the standard Array.au3 file that comes with AutoIt3. Most of the original _Arrayxxx functions didn't/don't support 2D arrays when using them. I have welded on the ability to use most of the existing functions with a 1 or 2D array. There are a couple of the _Array functions that I have not added this functionality to, mostly because I don't think it would be necessary and/or helpful for them to have it.

Here is a list of the functions included in the Array.au3 file that have been added and modified, taken from the header of the file

; #CURRENT# =====================================================================================================================
;_ArrayAdd *
;_ArrayBinarySearch *
;_ArrayCombinations
;_ArrayConcatenate *
;_ArrayDelete
;_ArrayDisplay *
;_ArrayFindAll
;_ArrayInsert *
;_ArrayMax *
;_ArrayMaxIndex
;_ArrayMin *
;_ArrayMinIndex
;_ArrayPermute
;_ArrayPop *
;_ArrayPush *
;_ArrayReverse *
;_ArraySearch
;_ArraySort
;_ArraySwap
;_ArrayToClip *
;_ArrayToString *
;_ArrayTrim *
;_ArrayUnique (Corrected the header information)
; * - #MODIFIED FUNCTIONS#
; ===============================================================================================================================
; #NEW FUNCTIONS ADDED# =========================================================================================================
;_ArrayAddColumns
;_ArrayDeleteColumn
;_ArrayMaxIndex2D
;_ArrayMinIndex2D
; ===============================================================================================================================

These modified functions are a drop in replacement for the original functions, they are backwards compatible with all scripts written to use the functions as originally written, but I have added the ability to use them with 2D arrays, as well as with 1D arrays. 2 of the new functions weren't written by me, _ArrayAddColumns and _ArrayDeleteColumn, but I have them in my arsenal of array functions so I figured it couldn't hurt to include them here as well. If anyone finds these useful, please let me know. If anyone finds any problems or bugs, I'd like to know that as well. Hopefully I have updated all of the function comment headers to reflect the changes, but if I have missed something let me know about that too so I can correct it.

As an added bonus, I am also posting an array related function called _FileWriteFromArray2D, which will write a 2D array to a file and is a modified version of _FileWriteFromArray that only works with 1D arrays. This could probably be incorporated into the _FileWriteFromArray function so that it would be able to handle 1D and 2D arrays natively pretty easily.

; #FUNCTION# ====================================================================================================================
; Name...........: _FileWriteFromArray2D
; Description ...: Writes Array records to the specified file.
; Syntax.........: _FileWriteFromArray2D($File, $a_Array[, $i_Base = 0[, $i_UBound = 0[, $cDelim]]])
; Parameters ....: $File     - String path of the file to write to, or a file handle returned from FileOpen().
;                 $a_Array  - The array to be written to the file.
;                 $i_Base   - Optional: Start Array index to read, normally set to 0 or 1. Default=0
;                 $i_Ubound - Optional: Set to the last record you want to write to the File. default=0 - whole array.
;                 $cDelim   - Optional: Delimiter character used to separate subitems in a row
; Return values .: Success - Returns a 1
;                 Failure - Returns a 0
;                 @Error  - 0 = No error.
;                 |1 = Error opening specified file
;                 |2 = Input is not an Array
;                 |3 = Error writing to file
;                 |4 = Array is not 2 dimensional
; Author ........: Jos van der Zande <jdeb at autoitscript dot com>
; Modified.......: Updated for file handles by PsaltyDS at the AutoIt forums.
; Remarks .......: If a string path is provided, the file is overwritten and closed.
;                 To use other write modes, like append or Unicode formats, open the file with FileOpen() first and pass the file handle instead.
;                 If a file handle is passed, the file will still be open after writing.
; Related .......: _FileReadToArray
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _FileWriteFromArray2D($File, $a_Array, $i_Base = 0, $i_UBound = 0, $cDelim = "|")
    ; Check if we have a valid array as input
    If Not IsArray($a_Array) Then Return SetError(2, 0, 0)
    ; determine last entry
    Local $last = UBound($a_Array) - 1, $iSubItem = UBound($a_Array, 2), $sFileWrite
    If $i_UBound < 1 Or $i_UBound > $last Then $i_UBound = $last
    If UBound($a_Array, 0) <> 2 Then Return SetError(4, 0, 0)
    If $i_Base < 0 Or $i_Base > $last Then $i_Base = 0
    ; Open output file for overwrite by default, or use input file handle if passed
    Local $hFile
    If IsString($File) Then
        $hFile = FileOpen($File, 2)
    Else
        $hFile = $File
    EndIf
    If $hFile = -1 Then Return SetError(1, 0, 0)
    ; Write array data to file
    Local $ErrorSav = 0
    For $x = $i_Base To $i_UBound
        $sFileWrite = ""
        For $i = 0 To $iSubItem - 1
            $sFileWrite &= $a_Array[$x][$i] & $cDelim
        Next
        $sFileWrite = StringTrimRight($sFileWrite, StringLen($cDelim))
        If FileWrite($hFile, $sFileWrite & @CRLF) = 0 Then
            $ErrorSav = 3
            ExitLoop
        EndIf
    Next
    ; Close file only if specified by a string path
    If IsString($File) Then FileClose($hFile)
    ; Return results
    If $ErrorSav Then Return SetError($ErrorSav, 0, 0)
    Return 1
EndFunc   ;==>_FileWriteFromArray2D

11/10/2011 - Updated attachment

Ran #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 on the contents of the file to eliminate any warning messages that might be popping up.

No functional changes to the functions, just cleaning up the mess of warning messages that didn't affect the working of the script, but might make the unwary nervous about them. All warnings have been fixed by declaring the variables correctly.

_Array.au3

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

This could probably be incorporated into the _FileWriteFromArray function so that it would be able to handle 1D and 2D arrays natively pretty easily.

There is something similar in BugTracker #1712, which is marked completed. But I'm not sure if just the 1-line fix to the existing routine, or the 1D/2D version was utilized.

PS - Nice work!

PPS - I hope parts of the Array.au3 UDF someday fade into oblivion. It seems a bloated UDF with functions of little use like ArrayCombinations, ArrayPermute, ArrayReverse, etc. There are also a slew of functions that only replace 3-5 lines of basic code, like ArraySwap, ArrayPop, ArrayMin(Index), ArrayMax(Index), etc. ArrayTrim probably fits into both categories :mellow:

Edited by Spiff59
Link to comment
Share on other sites

I was going through the Array.au3 file looking at some of the functions in it and wondering to myself if they are ever used. I'm sure they have uses to people, but I can't see me using them myself.

I got the urge one day to "fix" the _ArrayBinarySearch function so that I could use it on a 2D array because I didn't want to have to recreate the subitem in a separate array just to search it quicker than by using _ArraySearch. Once I had that one finished, I looked through the rest of the function list to see which ones could be "fixed" to work with more than just a 1D array and that is how I ended up with this modified version.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I got the urge one day to "fix" the _ArrayBinarySearch function

The array search, sort, and I/O functions are certainly keepers! Ones worth the effort to maintain and enhance.

I'm suprised that some of the others got by the watchful (critical) eye of Valik!

Func _ArrayPop(ByRef $Array)
    Local $i = UBound($Array) - 1, $str = $Array[$i]
    ReDim $Array[$i]
    Return $str
EndFunc

Edit: Added one (adjective) lol

Edited by Spiff59
Link to comment
Share on other sites

  • 2 months later...

I really like the idea of an enhanced UDF which supports 1D and 2D arrays.

I think users should be called to replace the original Array.au3 with your UDF and test their scripts. Results should be published here so you can see how good your UDF works.

Maybe after some time of testing your code could replace the official UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I wouldn't complain about that. I mention this thread whenever anyone posts about the 1/2D array issues. I'm not sure how else to "promote" it. :D

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I really like the idea of an enhanced UDF which supports 1D and 2D arrays.

I think users should be called to replace the original Array.au3 with your UDF and test their scripts. Results should be published here so you can see how good your UDF works.

Maybe after some time of testing your code could replace the official UDF.

I tested it with 2 of my scripts and I haven't found any issue or bug. It was very simple to update the existing script with this modified version.

I think this modified version should be part of the next autoit update !

Link to comment
Share on other sites

  • 2 weeks later...

I just downloaded as I was creating a quick script but didn't want the hassle of creating my own _ArrayInsert for a 2D array, this has a lot of potential. Thanks.

One thing I would say is use this #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 at the top of the script to check that it passes Au3Check.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Are you saying to add that ( #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7) to the _Array.au3 file, or to the scripts that use it?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

BrewManNH,

Add the line to the _Array.au3 script and run a syntax check to see if there are any problems with the UDF code. Fix them until you get a clean check. Then comment it out on release - or else lazy coders will never get any scripts to run at all as you will force the check on all their code! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I have updated the attachment in the original post with all corrections made that were causing warnings to show up during Au3Check. No changes to how the functions work, just declaring variables in the various functions correctly.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanks Melba23 for explaining I was a little late in replying and I can just see the comments now "my code shows an error but there isn't an error."

BrewManNH,

Have you never ran these parameters with your own code before?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I have, but didn't on this because I didn't think of it. Also, I tend to not make that kind of error when coding. :D

Most of what I modified was just adding the checks for 2D arrays and the functions to use them. Reusing the variable names caused 90% of the warnings because I originally developed them as a standalone function for 2D arrays only and then when I got them working, I merged them into the original Array.au3 file. Pretty much the only warnings that were showing up were the ones about variables already being declared, moving the declaration outside of the If...Then statements was all that was needed.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

BrewManNH,

Also, I tend to not make that kind of error when coding

Tempting fate a bit there, in my opinion! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

What's life without a bit of fate tempting now and then? Coding on the edge, at my age and condition it's about the best I can do. :D

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

It appears that the bonus function that I added to this thread (_FileWriteFromArray2D) isn't necessary because the beta versions of AutoIt, since version 3.3.7.0, has changed the _FileWriteFromArray function to support 1 and 2D arrays. It's not mentioned in any of the help file or changelog entries for the function but if you look at the bug tracker entry 1712 you will see it mentioned in there that to correct a crash issue with the function when it's sent a 2D array Spiff59 added 2D array support to the function which was added to File.AU3. For those not running the latest beta versions, I will leave it posted here as it is functionally the same as what was added to file.au3.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 5 months later...

I see an incompatibility between this version of _ArrayBinarySearch and the standard one. The parameter order of the standard version is

Func _ArrayBinarySearch(Const ByRef $avArray, $vValue, $iStart = 0, $iEnd = 0)

Yours is

Func _ArrayBinarySearch(Const ByRef $avArray, $vValue, $iSubItem = 0, $iStart = 0, $iEnd = 0)

If you moved the $iSubItem parameter to the end like this

Func _ArrayBinarySearch(Const ByRef $avArray, $vValue= 0, $iStart = 0, $iEnd = 0, $iSubItem = 0)

it would be more of a "drop-in replacement" for the standard UDF.

I also posted modifications to some of the _array_* functions to add enhancements () which you might want to incorporate.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...