pandel Posted March 13, 2015 Share Posted March 13, 2015 Hi! Recently, I changed from AutoIt 3.3.8.1 to 3.3.12.0. One of my older scripts broke at an _ArrayDelete statement. 3.3.8.1 - deleting the last element results in an empty string variable, so IsArray($ar) = false 3.3.12.1 - deleting the last element seems to result in an empty array variable, because now IsArray($ar) = true (and btw. _ArrayDisplay shows an empty array) Is that correct? When did that happen? Regards, Holger ScriptEditor with I18N support and customizable lexer completely written in AutoIt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2015 Moderators Share Posted March 13, 2015 pandel,As explained in the Help file:3.3.10.0 (23rd December, 2013) (Release)AutoIt:Added: Empty arrays.3.3.12.0 (1st June, 2014) (Release)UDFs:Changed: Re-wrote Array UDF to add 2D support and add some functions. THIS IS A SCRIPT BREAKING CHANGE.The Array library was quite comprehensively rewritten to take account of some of the changes made in the AutoIt core code concerning array handling. It seemed logical to return an empty array when there were no more elements after using _ArrayDelete so that elements could be added immediately using _ArrayAdd - and so avoid having to write error-checking code such as that you were obviously using with the earlier version. 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...
pandel Posted March 13, 2015 Author Share Posted March 13, 2015 Hey M23, I think I must be blind. I really did try to find some infos in the changelog before writing my post, but have overlooked this, completely! Many thanks and sorry! BTW: But it was very nice to have the possibility to delete the last element and to be sure IsArray is false now. With the new behaviour I have to check if is IsArray is false (and additionally) OR i.e. if _ArrayToString is -1... Regards, Holger ScriptEditor with I18N support and customizable lexer completely written in AutoIt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2015 Moderators Share Posted March 13, 2015 pandel,No need for all that - just check the size of the array using UBound. If the return is 0 then the array is empty or it is not an array. 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...
pandel Posted March 15, 2015 Author Share Posted March 15, 2015 Oh, Isee! I think I never tried using Ubound on a non-array variable. Would have expected that it returns an error. Very helpful, thanks! ScriptEditor with I18N support and customizable lexer completely written in AutoIt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 16, 2015 Moderators Share Posted March 16, 2015 pandel, Would have expected that it returns an errorIt does, but helpfully it also returns 0 as explained in the Help file: Success: the size of the array dimension.Failure: 0 and sets the @error flag to non-zero.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...
jchd Posted March 16, 2015 Share Posted March 16, 2015 Technically, a flat variable actually has dimension 0, so this shoudn't even raise @error. Analoguous to the 3D geometry we are used to: a point has dimension 0, a line ("list" of points) has dimension 1, a plane ("2D array" of points) has dimension 2, the geometric space clearly has 3 dimensions. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 16, 2015 Moderators Share Posted March 16, 2015 jchd,But it only sets the error flag when the variable datatype is not "Array" - and as far as the user is concerned there is a lot of difference between an array with no elements and another datatype when it comes to the code needed to manipulate the variable from then on. 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...
jchd Posted March 16, 2015 Share Posted March 16, 2015 it only sets the error flag when the variable datatype is not "Array" That's precisely what I call a technical error! Checking for array is adequately done by IsArray or even better UBound($var, 0). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now