Moderators Melba23 Posted January 23, 2014 Author Moderators Share Posted January 23, 2014 AdamUL,Good point about searching rows in _ArraySearch. I look and see how easy it would be to incorporate it. And I will also take a look at the _Array2D_SwapByIndex function - it certainly sounds more useful than the very basic version we have removed. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
BrewManNH Posted January 23, 2014 Share Posted January 23, 2014 (edited) You should mention that this will only work with the latest beta version of AutoIt, and doesn't work with the current release version. BTW, here's my take on a 2D version of _ArrayBinarySearch. expandcollapse popupFunc __ArrayBinarySearch(Const ByRef $avArray, $vValue, $iStart = 0, $iEnd = 0, $iSubItem = 0) If $iStart = Default Then $iStart = 0 If $iEnd = Default Then $iEnd = 0 If Not IsArray($avArray) Then Return SetError(1, 0, -1) If UBound($avArray, $UBOUND_DIMENSIONS) > 2 Then Return SetError(5, 0, -1) ; changes the error 5 condition to not a 1 or 2 D array Local $bIs2D = (UBound($avArray, 0) > 1) ? True : False Local $iUBound = UBound($avArray) - 1 If $iUBound = -1 Then Return SetError(6, 0, -1) ; Bounds checking If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd Then Return SetError(4, 0, -1) Local $iMid = Int(($iEnd + $iStart) / 2) If Not $bIs2D Then If $avArray[$iStart] > $vValue Or $avArray[$iEnd] < $vValue Then Return SetError(2, 0, -1) ; Search While $iStart <= $iMid And $vValue <> $avArray[$iMid] If $vValue < $avArray[$iMid] Then $iEnd = $iMid - 1 Else $iStart = $iMid + 1 EndIf $iMid = Int(($iEnd + $iStart) / 2) WEnd If $iStart > $iEnd Then Return SetError(3, 0, -1) ; Entry not found Else If $avArray[$iStart][$iSubItem] > $vValue Or $avArray[$iEnd][$iSubItem] < $vValue Then Return SetError(2, 0, -1) ; Search While $iStart <= $iMid And $vValue <> $avArray[$iMid][$iSubItem] If $vValue < $avArray[$iMid][$iSubItem] Then $iEnd = $iMid - 1 Else $iStart = $iMid + 1 EndIf $iMid = Int(($iEnd + $iStart) / 2) WEnd If $iStart > $iEnd Then Return SetError(3, 0, -1) ; Entry not found EndIf Return $iMid EndFunc ;==>__ArrayBinarySearch You'll probably notice that it's not much of a change from the original, the bounds checking is done with regards to 1 or 2D arrays now, and the searching is done on a specific "column" of the array. Edited January 23, 2014 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 GudeHow 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 More sharing options...
AdamUL Posted January 23, 2014 Share Posted January 23, 2014 @JLogan3o13 I was just offering an a more useful alternative to _ArraySwap, especially with 2D arrays, and I understand its removal. Adam Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 23, 2014 Author Moderators Share Posted January 23, 2014 Hi,I have posted a new version of the Beta library with examples in the first post - new versions of: _ArrayBinarySearch - now supports searching by column._ArraySearch - now supports searching by row._ArrayToString - user-defined delimiters for both items and rowsAnd I am still hoping for some comments about the proposed _ArrayAdd with multiple insert capability - this is not in the library yet as it is still only at the Alpha stage. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zedna Posted January 23, 2014 Share Posted January 23, 2014 And I am still hoping for some comments about the proposed _ArrayAdd with multiple insert capability - this is not in the library yet as it is still only at the Alpha stage. M23 What about ArrayAdd() and ArrayAddEx() ? This way were done some other UDFs. Just quick idea to disscussion without looking at sources ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted January 23, 2014 Share Posted January 23, 2014 Hi, I have posted a new version of the Beta library with examples in the first post - new versions of: _ArrayToString - user-defined delimiters for both items and rows Func _ArrayToClip(Const ByRef $avArray, $sDelim = "|", $iStart_Row = 0, $iEnd_Row = 0, $iStart_Col = 0, $iEnd_Col = 0) Local $sResult = _ArrayToString($avArray, $sDelim, $iStart_Row, $iEnd_Row, $iStart_Col, $iEnd_Col) 1) In _ArrayToClip() should be added $sDelim_Row as parameter too 2) In _ArrayToClip() is called _ArrayToString() with wrong parameters - missing new $sDelim_Row Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted January 23, 2014 Share Posted January 23, 2014 (edited) In _ArrayDisplay() there are buttons with English labels which is bad for non English users. There should be option to hide these buttons because they are not needed just for display of array, they are for copying etc. Some parameter $bWithoutButtons=False would be good for users who don't need these buttons. Such hidding will be better/easier than options for international localization of GUI. Edited January 23, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 23, 2014 Author Moderators Share Posted January 23, 2014 (edited) Zedna, What about ArrayAdd() and ArrayAddEx()Quite possible - but as the code is not too different (and so the speed penalty for single inserts is minimal) I think a single function is better. But unless I get some comments we are staying with the current version. _ArrayToClip()Oops. I will reload the library in a moment. In _ArrayDisplay() [...] There should be option to hide these buttonsI will look into it - but as there have been English-titled buttons in the _ArrayDisplay GUI since I have been using AutoIt and no-one has ever complained before, it will not be high on the priority list. M23Edit: Corrected library in first post - sorry about that. Edited January 23, 2014 by Melba23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zedna Posted January 23, 2014 Share Posted January 23, 2014 (edited) I will look into it - but as there have been English-titled buttons in the _ArrayDisplay GUI since I have been using AutoIt and no-one has ever complained before, it will not be high on the priority list. _ArrayDisplay() with non localized English buttons is problem for me (users of my projects) as non English ones. I use dirty workaround - I copy whole _ArrayDisplay() function into my project and remove/rip buttons from there manually. In _ArrayDisplay() there are options for dialog Title and ListView cloumn headers so the only non localized is text of buttons. These buttons were not in original _ArrayDisplay() they were added later so this is reason why I didn't complained earlier. Edited January 23, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 23, 2014 Author Moderators Share Posted January 23, 2014 Zedna, These buttons were not in original _ArrayDisplay() they were added laterThis code is from ArrayDisplay in v3.3.8.1 (my new version was only introduced late in the v3.3.9.# Beta cycle):; Set interface up Local $iWidth = 640, $iHeight = 480 Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight, Default, Default, BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX)) Local $aiGUISize = WinGetClientSize($hGUI) Local $hListView = GUICtrlCreateListView($sHeader, 0, 0, $aiGUISize[0], $aiGUISize[1] - 26, $_ARRAYCONSTANT_LVS_SHOWSELALWAYS) Local $hCopy = GUICtrlCreateButton("Copy Selected", 3, $aiGUISize[1] - 23, $aiGUISize[0] - 6, 20) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Perhaps it was not there in v3.2.12.1 release you say you run, but at least one button has been there for the past 2 years. As I said, I will look into adding an option to hide the buttons - but I intend to concentrate my effort on getting the _Array* functions working correctly.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
water Posted January 23, 2014 Share Posted January 23, 2014 Or would it be possible to pass the text for the four buttons to _ArrayDisplay? $sButtons = Default ; Buttons with labels in English $sButtons = "" ; Hide all buttons $sButtons = "Copy Data & Hdr/Row|Copy Data Only|Run user Func|Exit Script" ; Set the label text for the 4 buttons 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 More sharing options...
Zedna Posted January 23, 2014 Share Posted January 23, 2014 @water I like your idea very much! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2014 Author Moderators Share Posted January 24, 2014 (edited) water & Zedna,It was agreed in the previous _ArrayDisplay thread that the function was intended primarily for debugging. As coders using AutoIt need a minimum level of English comprehension to use the various commands and parameters - which are all English-based - I feel it is reasonable for them also to be expected to understand the simple text on these buttons. If a coder wishes an array to be displayed to a user - whose level of English might well be zero - then it is the coder's responsibility to present the array in a form suitable to the user. If the coder wishes to use the _ArrayDisplay code as the basis for a personalised function then so be it, but I do not believe that adding language options to a standard AutoIt function is how we should proceed.On a more positive note, I have looked at the code this morning and it is extremely easy to hide the buttons (it only adds 4 lines to the code) so I am quite prepared to add that functionality if there is support for it:<snip>Happy with that? M23 Edited January 25, 2014 by Melba23 Code removed 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
water Posted January 24, 2014 Share Posted January 24, 2014 I know that _ArrayDisplay was primarily intended for debugging. But as the function now has a lot of new features it is more and more suited for production work. This leads to new requirements ... I understand that you have to draw a line and that coders can create their own function (based on your code) and add missing features. Conclusion: I'm happy with what _ArrayDisplay offers now but am open for future enhancements. Just wanted to add my 0.02 $. 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 More sharing options...
Moderators Melba23 Posted January 24, 2014 Author Moderators Share Posted January 24, 2014 (edited) AdamUL (and amnyone else reading),How does this first attempt at a _ArraySwapByIndex function grab you: <snip>On a more general point, I have used a "True/False" flag in the new versions of both _ArraySearch and this function to indicate which dimension is involved. Is this satisfactory or would people prefer "Row/Col" or "R/C"?M23 Edited January 25, 2014 by Melba23 Code removed 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Gianni Posted January 24, 2014 Share Posted January 24, 2014 Hi, I cannot find a suitable logic for multiple inserts - how do you deal with the required indices given that their initial location will change as the other items are inserted above them. An example of what I mean: Original - Insert 1,3 This way? Or this way? 0 0 0 1 New A ; Item 1 New A 2 1 1 3 New B ; item 3 in new array 2 4 2 New B ; above item 3 in old array 3 3 4 4 .... to insert multiple lines at once, ms Excel uses method 2 (and I agree with that ) Original - Insert 1,3 Or this way? <-- (excel uses this way) 0 0 1 New A 2 1 3 2 4 New B ; above item 3 in old array 3 4 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Zedna Posted January 24, 2014 Share Posted January 24, 2014 water & Zedna, On a more positive note, I have looked at the code this morning and it is extremely easy to hide the buttons (it only adds 4 lines to the code) so I am quite prepared to add that functionality if there is support for it: Happy with that? M23 I will be more than happy with such option for hidding of all buttons. Thanks! There is only small not optimal code: Local $iButtonMargin = 46 Local $iButtonMargin = (BitAND($iFlags, 16)) ? (0) : (46) First line of code is not needed at all. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AdamUL Posted January 24, 2014 Share Posted January 24, 2014 @Melba23 I like the new function, with the additional feature of selecting a range. I think the row flag is a good idea, and to me more intuitive. What's also nice is it is a drop in replacement for _ArraySwap, but a lot more useful. This should help with users that may complain about the script breaking change of _ArraySwap's removal. Adam Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2014 Author Moderators Share Posted January 24, 2014 AdamUL,Glad you like it. In response to your other request, have you tried the new _ArraySearch which now allows row searching? It is in the Beta library in the first post. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2014 Author Moderators Share Posted January 24, 2014 (edited) Hi,The current versions of _ArrayAdd with examples:<snip>and also _ArrayInsert<snip>They allow for multiple item addition/insertion to speed things up dramatically. As always comments welcome. I intend to post a final Beta library tomorrow morning which will give people all weekend to play around with it. I also hope to post the proposed Help file pages and examples - but that might be a bit later as it will depend on my enthusiasm levels this evening! M23 Edited January 25, 2014 by Melba23 Code removed 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts