DXRW4E Posted January 4, 2014 Share Posted January 4, 2014 (edited) can be enabled (in Array access on expression) to readaccess the first itemelement directly (without specify it), example Local $aTest1[4] = [1,2,3,4], $aTest2[4] = ["One","Two","Three","Four"], $aTest3[4][4] = [[0,1,2,3],[4,5,6,7]], $aTest4 If ($aTest1) = 1 Then ;ect ect ect EndIf If ($aTest2) = "One" Then ;ect ect ect EndIf If ($aTest3) = 0 Then ;ect ect ect EndIf If ($aTest4) = "XXXX" Then ;ect ect ect EndIf would be useful during DllCall or other Function that return array variable, so do not need to check first if the $aTest is an valid array variable ect ect Ciao. Edited January 4, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
Mat Posted January 5, 2014 Share Posted January 5, 2014 My reply from trac. #2604 Resolution set to Rejected Status changed from new to closed Not a good idea. It would have to be a special case, that only applies when the array is used with a comparison operator as there would be other cases where it wouldn't work. We'd probably start seeing code like: If $a = 0 Then $a = 4 EndIf A confusing feature, especially in a large code base, even with systems hungarian. For pretty much no saving either. Sure for arrays that have the count in the first index it might be nice. I've rejected the request. PM me on the forums if you want to discuss it further, if another MVP or dev would like this feature then they can re-open the ticket. AutoIt Project Listing Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) My reply from trac. #2604Resolution set to RejectedStatus changed from new to closedNot a good ideai think you made your decision a little early, you are wrong because the feature already exists ??, you know that right??AutoIt v3.3.10.0 (23rd December, 2013) (Release)Added: Array access on expression: StringSplit("a,b", ",")[1]Retun (StringSplit("a,b", ","))[0] ;or Retun (StringSplit("a,b", ",")) ;Improvement (Feature) Requesthowever i think you have not understood very well the (Feature) Request, everything refers to the Array access on expression (Feature that already exists, i asked only an improvement), there is nothing to be confused, Array access on expression never modify the array variabledata, indeed is useful during Return or Comparison or Assignment or anything like thatthere are a lot of differences, StringSplit always return arrays so never happens error, but it is very useful in cases happens error, to give an example;ERROR, if error happens during Dllcall, name.dll not found or other Return (DllCall("name.dll", "int", "FuncName", "str", "", "int", 111))[0] ;is always OK, even if error happens during Dllcall, name.dll not found or other Return (DllCall("name.dll", "int", "FuncName", "str", "", "int", 111)) ;Improvement (Feature) Requestis the same thing also during the Comparison or Assignment or anything like that, so never go in error, even if variable is arrays or not, here is to avoid these errorsLocal $aTest[4] = ["One","Two","Three","Four"], $sTest, $aTest2 $sTest = ($aTest) ;Improvement (Feature) Request ConsoleWrite("$sTest - " & $sTest & @LF) $sTest = ($aTest)[0] ConsoleWrite("$sTest - " & $sTest & @LF) $aTest2 = "Two" $sTest = ($aTest2) ;Improvement (Feature) Request ConsoleWrite("$sTest - " & $sTest & @LF) $sTest = ($aTest2)[0] ConsoleWrite("$sTest - " & $sTest & @LF) ;~ >Running AU3Check (3.3.11.1) from:C:\Program Files (x86)\AutoIt3\Beta ;~ +>02:50:57 AU3Check ended.rc:0 ;~ >Running:(3.3.11.1):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:\Users\DXRW4E\Desktop\New AutoIt v3 Script.au3" ;~ --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop ;~ $sTest - ;~ $sTest - One ;~ $sTest - Two ;~ "C:\Users\DXRW4E\Desktop\New AutoIt v3 Script.au3" (10) : ==> Subscript used on non-accessible variable.: ;~ $sTest = ($aTest2)[0] ;~ $sTest = ($aTest2)^ ERROR ;~ ->02:50:57 AutoIt3.exe ended.rc:1 ;~ >Exit code: 1 Time: 0.436everything will be as always nothing will change, so it does not create confusion, but to the contrary, it helps a lot in all casesCiao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 5, 2014 Share Posted January 5, 2014 How are you supposed to distinguish between checking the array and checking the first element? I'm not seeing any new syntax there. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 5, 2014 Moderators Share Posted January 5, 2014 DXRW4E,I see absolutely no benefit in this feature request - to my eyes all it will add is confusion between:$sTest = ($aTest) ;Improvement (Feature) Request to return the [0] element ; and $sTest = $aTest ; Existing syntax for copying of an arrayAnd Mat's snippet from Trac is another example where confusion is likely to occur. Please remember that AutoIt is designed for all levels of coder. Many feature requests are from experienced coders and more often than not are aimed at edge cases. The AutoIt team have to think of the language as a whole and some of these suggestions are deemed likely to be more trouble that they are worth. Do not take this personally - if there were no suggestions for improvements then we would all suffer - but please bear in mind that although you can make suggestions there is nothing that says they have to be accepted. 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...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) Hi Melba23, is all Ok, the long post above is not out of anger or anything like that, indeed (how to say) even if i do not liked the answer, i found the post of Mat kindlyfriendly (although as i said i think it was wrong), it was just to explain why i think so nothing else I see absolutely no benefit in this feature request - to my eyes all it will add is confusion between:$sTest = ($aTest) ;Improvement (Feature) Request to return the [0] element ; and $sTest = $aTest ; Existing syntax for copying of an arrayI think in my post above there are examples of why is helpful, as i said this does not change anything in autoit script, so no one confuses them, those who want to can use the feature, who does not want does not use it is everything same, will be just the same as the use of the Array access on expression, as said the feature already exists (for this in the beginning is wrote "can be enabled" and not "can be added") Do not take this personallydo not worry never took it personally, in general i believe one that takes its decisions, has its reasons right or wrong they are, so in the end is everything is ok for mehowever to make (all) it short, i really do not see where is the confusion here, for now in AutoIt ($aArray) is equal to '""' (None), only asked to pass ($aArray) equal the first element nothing else what changes or what confuses this ??Ciao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) How are you supposed to distinguish between checking the array and checking the first element? I'm not seeing any new syntax there.just as you do right now, or how you always fate, nothing will change themCiao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 5, 2014 Share Posted January 5, 2014 just as you do right now, or how you always fate, nothing will change them Ciao. I'm afraid that this means absolutely nothing to me. Could you rephrase it? Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) I'm afraid that this means absolutely nothing to me. Could you rephrase it? as you've always done, does not change anything there Local $aArray[2] = [1, "Test"], $aTest, $sTest, $iTest $aTest = $aArray $sTest = $aArray[1] $iTest = ($aArray)[0] $iTest = ($aArray) ; "" $iTest = ($aArray) ; Improvement (Feature) Request to return the [0] element so what need to know or to add here Ciao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
Mat Posted January 5, 2014 Share Posted January 5, 2014 So with IsArray($aTest) what happens? AutoIt Project Listing Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) So with IsArray($aTest) what happens?What changes ??, or what will have to happen ?? Ciao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
Mat Posted January 5, 2014 Share Posted January 5, 2014 Well if it now evaluates to the first element then it will always return false. AutoIt Project Listing Link to comment Share on other sites More sharing options...
trancexx Posted January 5, 2014 Share Posted January 5, 2014 Well if it now evaluates to the first element then it will always return false. No it wouldn't. DXRW4E, the idea not good because you are somehow forgetting that first element of array can be some other array. Try your idea with that in mind now. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) Well if it now evaluates to the first element then it will always return false.I think nothing more and nothing less, of what happens when it was added Array access on expressionn in AutoIt v3.3.10.0 DXRW4E, the idea not good because you are somehow forgetting that first element of array can be some other array. Try your idea with that in mind now.right observation, in that case return '""' (None), as always (as is already do now), where the problem ?? (as i said nothing is going to change them), however as always is the duty of user to be certain at what he does, there does not exist any thing without the risk ehhhCiao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
trancexx Posted January 5, 2014 Share Posted January 5, 2014 (edited) right observation, in that case the return '""' (None), as always (as is already do now), where the problem ?? (as i said nothing is going to change them), however as always is the duty of user to be certain at what he does, there does not exist any thing without the risk Ciao. See this: Local $aOtherArray = [555, 444, 333] Local $aArray = [$aOtherArray, 2, 3] $vVal = ($aArray)[0] ConsoleWrite($vVal & @CRLF) That code prints nothing (array is "nonprintable"). That's what is should print. With your idea it would print 555. Do you see how this breaks scripts? Edited January 5, 2014 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) Hi trancexx, no it will have to Return None ??? $aArray[0] is array of arry, so Local $aOtherArray = [555, 444, 333] Local $aArray = [$aOtherArray, 2, 3] ;$aArray[0] is Array of Array ; ($aArray)[0] ; is Array ; ($aArray[0])[0] is equa 555 ; ($aArray[0]) ; Improvement (Feature) Request, will have to Return 555 ;$vVal = ($aArray)[0] ;Array ;ConsoleWrite($vVal & @CRLF) $vVal = ($aArray[0]) ; Improvement (Feature) Request to return the [0] element, will have to Return 555 ConsoleWrite($vVal & @CRLF) $vVal = ($aArray) ; Improvement (Feature) Request to return the [0] element, will have to Return '""' None or Array ; since the $aArray[0] is arrays, as already mentioned as is already do ConsoleWrite($vVal & @CRLF) Ciao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
trancexx Posted January 5, 2014 Share Posted January 5, 2014 But if ($aArray) is first element then ($aArray)[0] is first element of first element. Isn't it? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) Hi trancexx, is creating confusion for nothing, I mean is simple if the return is Array or other as always return dataNonearray (is not important), as I said nothing will change them (nothing at all), just as it does with the Array access on expression anything else, just to change the return None of ($aArray) with ($aArray) return firs element, so the ($aArray) will always be equal to the ($aArray)[0], but for the reasons said in the post before ($aArray) is more help in many situations, since return will always be OK (valid, no AutoIt Error), no need to check first if the $aArray is a valid array variable, exampe ;is OK, but if error happens during Dllcall ehhh, Autoit Error (blocks\terminates execution) of the exe\script If (DllCall("Kernel32.dll", "long", "GetLastError"))[0] Then ;ect ect EndIf ;;or Return SetError((DllCall("Kernel32.dll", "long", "GetLastError"))[0], 0, $data) ;is always OK, even if error happens during Dllcall, Kernel32.dll not found or other If (DllCall("Kernel32.dll", "long", "GetLastError")) Then;Improvement (Feature) Reques ;ect ect EndIf ;;or Return SetError((DllCall("Kernel32.dll", "long", "GetLastError")), 0, $data) in poor words ($aArray) for now has no function in Autoit (always return None, if you do not use the Array access on expression), everything so simple nothing will change them, only add that the ($aArray) from None to Return firs element Ciao. Edited January 5, 2014 by DXRW4E Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 5, 2014 Share Posted January 5, 2014 trancexx actually has an excellent related point. There seems to be a language issue preventing you from understanding what we are saying. Link to comment Share on other sites More sharing options...
DXRW4E Posted January 5, 2014 Author Share Posted January 5, 2014 (edited) There seems to be a language issue preventing you from understanding what we are saying.in poor words ($aArray) for now has no function in Autoit (always return None, if you do not use the Array access on expression), everything so simple nothing will change them, only add that the ($aArray) from None to Return firs elementyou see any problem here?? Edited January 5, 2014 by DXRW4E 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