Jump to content

_ArrayAdd problem


Recommended Posts

  • Moderators

thebreaker,

I hear you - but yours is the only dissenting voice since I began this rewrite back in January so I hope you understand if I do not change it to meet your personal expectations. Especially since I have now amended the function to do as you require - even if it means you might need to add a few extra parameters to your code. :)

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 hear you - but yours is the only dissenting voice since I began this rewrite back in January so I hope you understand if I do not change it to meet your personal expectations. Especially since I have now amended the function to do as you require - even if it means you might need to add a few extra parameters to your code. :)

 

 

This is not only about my personal expectation. I could use the old version of the module and everything works as before.

The question is what the general expectations from users/programmers using functions are and what your (or the AutoIt projects') standards / guidelines are to define functions and modules.

I think my expectation would be common sense between programmers and program language / API designers. If this is the case, the function should IMHO be changed (again). The absence of objections is not necessarily the best basis for a decision - I don't know how many think about such things or follow these threads.

Of course, the decision is yours. I just want to make sure my point is understood correctly.

Link to comment
Share on other sites

After some playing, I like the old _ArrayAdd behavior better.  Busting up arrays and adding as individual items seems more like...... _ArrayConcatenate?   I know I am late to the party, as requirements prevented my upgrade, but this is the second UDF I have encountered in which functions that yield completely different returns are deemed "replacements" rather than "additions". 

i only have single elements and 1D arrays, and if I had to update my old scripts I would probably go this route so I only have to change the ArrayAdd to set an unused delimiter, and swap the isarray check for stringinstr and stringsplit.

#include <Array.au3>

Global $aArray[1] = ["test"]
Global $bArray[2] = ["B1" , "B2"]

_ArrayAdd($aArray, "test2")
_ArrayAdd($aArray, _ArrayToString($bArray) , 0 , "^")

for $i = 0 to ubound($aArray) - 1
    If stringinstr($aArray[$i] , "|") Then
        $aElement = stringsplit($aArray[$i] , "|" , 2)
        _ArrayDisplay($aElement)
    Else
        msgbox(0, '' , $aArray[$i])
    EndIf
Next
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • Moderators

Hi,

After a lot of discussion behind the scenes we have come up with a solution. The function will accept a range of pre-defined constants to change its behaviour. The default will remain auto-splitting added items, as that was one of the major requests when I started the library rewrite. But those who want to have the previous behaviour of adding data as a single item can simply amend their personal version of the function to use the "SINGLEITEM" constant as the default. :)

I will be committing the change tomorrow. Thanks to those who took the time to reply, even if none of you were happy - I hope you are now. :whistle:

M23

Edit: Committed. :)

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

  • Moderators

RTFC,

As Basil Fawlty once remarked: "A satisfied customer. We should have him stuffed". Glad you like the final result. :)

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

  • 1 month later...
  • Moderators

You can find the source for array.au3 in the Include folder in the directory where you installed AutoIt. The source for AutoIt itself is no longer openly available (for the current version, at least)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I meant the newest version of the script of course. The downloadable AutoIt version (installer) is dated from before the change was made and does not contain it I believe.

It doesn't make sense if we talk here about a changed version of an include file and I can't download the current development version from somewhere...

Sad that Autoit source is not available anymore publicly. I assume one must pay for it some day and I can now look for an alternative.

Link to comment
Share on other sites

  • Moderators

thebreaker,

The latest version of the Array library is in Beta v3.3.13.19 - just install that and you will have access to it. ;)

AutoIt not being open source has nothing to do with plans to make people pay to use it. As far as I know it will remain free to use for the foreseeable future, so no need to look around just yet. :)

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

  • 1 month later...

After a while blocked, stuck with this strange behaviour of _arrayadd I found this thread, and I read all the opinions.

My 2 cents: ok this isn't the first script breaking change, but I think you have to "switch on" this "auto explode" mode of _Arrayadd, you cannot hope that "|" is not so common used...

Looked at the beta, but for now: 

_arrayadd($finalarray, $linesArray[$i],0,"¥")

I'll pay this in Yen  :bye:

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...