Jump to content

_ArrayAdd problem


Recommended Posts

May be i missed something in recent script-breaking changes., but i'm trying the last version (3.3.12.0)  and i can't get _ArrayAdd Function working as previous versions...

Try this :

#include <Array.au3>
;~ Opt ( 'GUIDataSeparatorChar', '*' )

Global $aLinks[1]
Global $aDatas[5] = [ '1', '2', '3', '4', '5' ]

_ArrayAdd ( $aLinks, $aDatas[0] & '|' & $aDatas[1] & '|' & $aDatas[2] & '|' & $aDatas[3] & '|' & $aDatas[4] )
ConsoleWrite ( 'UBound ( $aLinks, 1 ) -1 : ' & UBound ( $aLinks, 1 ) -1 & @Crlf )
_ArrayDisplay ( $aLinks )

Edit : Ok i found a solution : use another delimiter than '|' 

 

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Other than the rewrite of the array functions, that shouldn't have happened.

That is a bug in the function _ArrayAdd, instead of assuming that the incoming data should be added to the array, it's assuming that if there's a delimiter in the incoming text that it should split it and create the array wrong.

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

No because the function doesn't allow for a change of delimiter unless you add it to the function call.

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

Hi,

 

That is a bug in the function _ArrayAdd

No it is not - the function is behaving just as the Help file says it will:

 

1D arrays:

Single item - adds 1 element

$sDelim_Item delimited string - adds as many elements as items

If you want the "|"-delimited string to be added as a single item then redefine the required delimiter when calling the function:

#include <Array.au3>
;~ Opt ( 'GUIDataSeparatorChar', '*' )

Global $aLinks[1]
Global $aDatas[5] = [ '1', '2', '3', '4', '5' ]

; Redefine the required delimiter
_ArrayAdd ( $aLinks, $aDatas[0] & '|' & $aDatas[1] & '|' & $aDatas[2] & '|' & $aDatas[3] & '|' & $aDatas[4] , 0, "-")
ConsoleWrite ( 'UBound ( $aLinks, 1 ) -1 : ' & UBound ( $aLinks, 1 ) -1 & @Crlf )
_ArrayDisplay ( $aLinks )
As stated in the changelog:

 

Changed: Re-wrote Array UDF to add 2D support and add some functions. THIS IS A SCRIPT BREAKING CHANGE.

So the function is working as designed - but not the same way as before, which is what the changelog says. :)

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

Ok, so it's working as intended, but should that be the way it should work? Just because it's listed in the changelog doesn't mean it was a good change.

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,

The new _Array_Add function has been working like that since the Array library rewrite began. I asked for comment here and here - no-one mentioned any concerns at the time. And the new library has been in the Beta since v3.3.11.4 released on 7 April 2014 - again with no complaints until now.

Is it as good change? In my opinion it is - the entire Array library now offers 1D/2D functionality (where sensible) and the change required to scripts in this particular _ArrayAdd case is minimal. :)

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 see no issue and made my opinion well known on this matter.

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 never tested _ArrayAdd because I have no use for it myself, so that one slipped by me.

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,

So what would you have suggested as an alternative method had you noticed and commented during the past 4+ months? :huh:

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

First, I would see what the the current delimiter is set to rather than assuming it's "|" (Opt("GUIDataSeparatorChar")), currently the function doesn't take into account that someone might be using a different one. If they use the Default keyword, it should grab the current delimiter to use to split the text.

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 thought private range Unicode characters had been selected for delimiters. I haven't got so far as testing anything, so I don't know what's changed yet. The discussion about this was about 6 months ago.


Hmm!

I suppose it doesn't make a difference if the delimiter in the string is not specified by the user.

Edited by czardas
Link to comment
Share on other sites

  • Moderators

BrewManNH,

Alas you are going to be very disappointed when you finally get around to looking closely at the Array library - the default delimiter is also set to "|" in the Insert, ToClip & ToString functions. I can only presume that you do not use those functions either and so never looked at nor tested them when I sought comment. But as I demonstrated earlier, it is very easy for the user to set another delimiter when calling the functions, so I do not see any reason to change them now. :)


czardas,

A Unicode character is used as a delimiter in _ArrayDisplay so that all characters will display - nothing to do with how delimited strings are split elsewhere in the library. ;)

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

Hi Melba, other devs et al.,

While  fixing my broken CodeScanner I came across this novel _ArrayAdd change, when trying to add the string "|" to a 1D array, which fails (it stores two single quotationmarks, like so:

#include <Array.au3>
Local $test[1]
$text='"|"'
_ArrayAdd($test,$text)
_arraydisplay($test)

I understood the new helptext to mean that the new 2D-supported functionality would not apply when parsing a 1D array. Yet my example still produces two separate entries. :(

Before I go and rewrite every _arrayAdd I ever used (and CodeScanner has to be able to process any string, so I would have to determine what dummy character I could use as faux delimiter for every instance separately), I'd greatly appreciate  it if somebody could clarify whether my example's behaviour is supposed to happen or whether _arrayAdd needs to distinguish between 1D/2D cases before processing delimiter characters by default as delimiters and not as characters. I'm slightly confused.

Thanks in advance for any help. :)

Edit: upon further reflection, I guess the default delimiter applies to 1D cases too. I can see that this could be useful, it just creates a serious headache for my codes. :x

 

Oh, one other thing re. Array.au3,  the new _ArraySwap helptext refers to boolean $bRow, which if true should swap rows (if I understand it correctly, that is), but looking at the example it seems to swap columns when true :huh: , so should perhaps be renamed $bCol??? Or am I missing something?

Edited by RTFC
Link to comment
Share on other sites

  • Moderators

RTFC,

 

Before I go and rewrite every _arrayAdd I ever used

Sorry, but we did warn that "THIS IS A SCRIPT BREAKING CHANGE" when we released the new Array library. We felt the added functionality was worth the inconvenience. :(

 

if somebody could clarify whether my example's behaviour is supposed to happen

I thought I did that in post #5. What happens in that script is exactly how the UDF is designed. ;)

 

I understood the new helptext to mean that the new 2D-supported functionality would not apply when parsing a 1D array

I am afraid that you understood incorrectly - and this has nothing to do with 2D functionality. Did you run the first of the associated examples in the Help file - the section headed:

; Add a delimited string - each item adds new element
shows exactly what happens with a "|" delimited string - as stated each item adds a new element. ;)

 

CodeScanner has to be able to process any string, so I would have to determine what dummy character I could use as faux delimiter for every instance separately

I do not believe that is necessary. All you need do is set the required delimiter to a non-used character (we used one of the user-defined Unicode characters in _ArrayDisplay) when you call the function - as I also demonstrated in post #5. That way your string will never be converted to multiple elements as the delimiter will never match - so a simple fix which you can simply paste in every time you call the function. :)

I will look into the _ArraySwap code later - thanks for the heads-up. :thumbsup:

M23

Edit: Looks like I got the Help file the wrong way round for the parameter in _ArraySwap - thanks again for pointing it out. :)

Edited by Melba23

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 guess I owe you an apology, Melba. :>  I didn't check that example you mentioned, and I guess I should have looked into the background of this change more carefully before posting. I did work out my own workaround as well, and the expansion to support 2D arrays more substantially is of course a welcome addition.  But I guess any script-breaking change will elicit lots of frustration if only because of the change itself and the bother of adjustments to be made to scripts that were functional before (my CodeScanner will be leaving intensive care soon though, just ironing out some creases now). I've also had several bad experiences with other formerly working environments that took many, many days to get up and running again after a harmless little upgrade (<cough>MSVC<cough>Nvidia<cough> :whistle: ). It's then easy to slip into a kneejerk reaction whenever anything breaks. That's no excuse, though, more post hoc rationalisation. ;)

Edit: as an afterthought, would it perhaps make sense to include the option to parse an empty string for the user-defined delimiter to indicate that row-splitting should not be applied?

Edited by RTFC
Link to comment
Share on other sites

  • Moderators

RTFC,

No problems - I quite understand. But we did try to make the changes as obvious as possible - there is even a special page in the Help file explaining the changes to the Array library. :)

 

When I was rewriting the Array library I did consider adding code to look for the character set in Opt(GUIDataSeparatorChar) but I decided against it and I still believe that the solution of having parameters for the user to set specified delimiters is the better option. But we may just have to agree to differ on this point. ;)

M23

P.S.

post hoc rationalisation

Got the tee-shirt for that one! :D

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

  • 1 month later...

I have a serious problem with the _ArrayAdd function as well:

I already read that the syntax changed, and although it means I have to change my scripts, I can live with that.

But I can't make the new function support what I need:

What I currently use as functionality from the "old" version of _ArrayAdd is to store whole arrays as objects in an array.

My use case is that I read many files (with _FileReadToArray) which I use later on.

To avoid that the files have to be read multiple times, I store them in an array with _ArrayAdd($dataArray, $myFileContentArray).

The problem is that the new _ArrayAdd function detects that the object I want to add is an array, splits it up and adds the single elements (lines). That's not what I want.

How can I have the old behavior (storing the whole "file content array" as one element)? I read that the new _ArrayAdd has this $hDataType parameter. Is there a possible value I could use to make the new _ArrayAdd store the complete array as with the old _ArrayAdd function? I did not find something in the documentation.

Link to comment
Share on other sites

  • Moderators

thebreaker,

Welcome to the AutoIt forums. :)

You can very easily do what you want with a simple function:

<snip>

I will look at the UDF to see how I might add this functionality to the existing _ArrayAdd function. ;)

M23

Edit: See next post. :)

Edited by Melba23

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...