Jump to content

Recommended Posts

  • Moderators
Posted

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

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

 

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

Func __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 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

Posted

@JLogan3o13

I was just offering an a more useful alternative to _ArraySwap, especially with 2D arrays, and I understand its removal.  

 

Adam

  • Moderators
Posted

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 rows

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

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

 

Posted

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

Posted

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

Posted (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 by Zedna
  • Moderators
Posted (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 buttons

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

M23

Edit: Corrected library in first post - sorry about that.

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

 

Posted (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 by Zedna
  • Moderators
Posted

Zedna,

 

These buttons were not in original _ArrayDisplay() they were added later

This 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

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

 

Posted

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

 

  • Moderators
Posted (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 by Melba23
Code removed

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

 

Posted

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

 

  • Moderators
Posted (edited)

AdamUL (and amnyone else reading),

How does this first attempt at a _ArraySwapByIndex function grab you: :huh:

<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 by Melba23
Code removed

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

 

Posted

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  :whistle: )

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

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.

Posted

@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

  • Moderators
Posted

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

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

 

  • Moderators
Posted (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! :D

M23

Edited by Melba23
Code removed

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

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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