imitto

_ArrayMin problem on 2D array

5 posts in this topic

#1 ·  Posted (edited)

Hi!

I just playing around with _ArrayMin for my next project, but seems like it's not working. I think the code is OK, but I always get the value of $aArray[2][1], not col 2's lowest value (see attached image)

Zx80ocu.png

Edited by imitto

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

54 minutes ago, imitto said:

always get the value of $aArray[2][1]

Not value of [2][1]. You get the value of [0][2], because you searching from index 0 to index 0.

_ArrayMin($aArray, 1, -1, -1, 2)

 

Edited by InnI

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

15 minutes ago, InnI said:

Not value of [2][1]. You get the value of [0][2], because you searching from index 0 to index 0.

_ArrayMin($aArray, 1, -1, -1, 2)

Thank you! Then it's not OK in the help file, the code is made of it.

Edited by imitto

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

16 minutes ago, imitto said:

Then it's not OK in the help file, the code is made of it.

Seems like you use help file from old version. Click to _ArrayMin function in your or my post and read current help (for AutoIt 3.3.14.2).

Edited by InnI

Share this post


Link to post
Share on other sites

#5 ·  Posted

Hmm. imitto is right. The sample code in the current 3.3.14.2 help still uses : _ArrayMin($aArray, 1, 0, 0, 2)

BTW this should have been mentioned in AutoIt changelog as a 'script breaking change'

Share this post


Link to post
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

  • Similar Content

    • distancesprinter
      By distancesprinter
      _ArrayDisplay($aArray, "Window Title", "1:", 0, Default, "Column") ; Expected results are rows 1 to the end of the array, all columns. The result is rows 0-1, all columns. The API reference is here:
      https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayDisplay.htm
       
      Am I doing something wrong?
    • nss
      By nss
      Hi all.
       
      Because of me wondering if I could access the key/value pair arrays with the numbers as indexes, I have found out that the zeroth element for some reason doesn't return anything.
      Here's the example:
       
      local $r[2] $r["test1"]="hello" $r["test2"]="how are you" msgbox(64, $r[0], $r[1]) ; prints the ["test2"] but not ["test1"]. Is this even supposed to be a thing?  
       
      BTW, I haven't seen Autoit get updated since 2015; is it abandened or something?
      Any help/clarification appreciated.
    • TheDcoder
      By TheDcoder
      Hello everyone, I discovered a bug yesterday and I posted it at the bug tracker:
      I also made a simple script which can be used to reproduce the bug:
      CreateVariable() ConsoleWrite($sGlobalVariable & @CRLF) Func CreateVariable() Global $sGlobalVariable = "Foobar" EndFunc The bug was closed by @BrewManNH:
      While I partially agree with the above statement, My code was not practical enough... so @mLipok advised me to create a thread on the forums with practical code (Thanks!). That is the point of this thread, I am going to provide the code where I experience this bug/problem .
      I discovered this bug when I was working on one of my projects called "ProxAllium". When the main script finishes execution, Au3Check throws a nasty warning about "variable possibly used before declaration":

      As you can see, the variable is indeed being used after calling the function in which the variable is declared... The warning won't appear if I declare the function ABOVE the variable. As @BrewManNH said, Au3Check reads line by line... I think this should be changed, Au3Check should not throw warnings if the interpreter is able to run the code, at least most of the time anyway!
      So what do you guys think? Is this a valid bug?... and I request those who participate in the discussion not to discuss the code being "poor", that is another thing/thread in itself
      P.S I had already written this once but the forum editor decided to mess up and when I undid (Ctrl + Z) something... This is a poorly written version of that article, I was very frustrated while writing this!
    • WoodGrain
      By WoodGrain
      Hi All,
      Could someone please PLEASE tell me what I'm doing wrong here?
      I feel like I'm close to figuring this out, I think I've identified what is causing the issue.
      Whenever I try to use the hotkey CTRL+SHIFT+T (or any other letter other than T for that matter) to paste the text to notepad, my CTRL and SHIFT keys are held down *IF* I release them *WHILE* the raw text is being written.
      It seems to be that if I release the CTRL+SHIFT keys:
      Before the Send Raw text starts to write to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good During the Send Raw text being written to the screen: the CTRL and SHIFT keys ARE held down perpetually until I physically press them on the keyboard, this is bad After the Send Raw text has written all text to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good This is also the case if I were to use the Windows Key as the hot key instead of the CTRL+SHIFT, I would need to tap the WIN key physically on my keyboard if I released it while the raw tet was being sent to the screen (eg, WIN+T).
      This issue also happens no matter which program I try to write the text to.
      Here's some example code:
      (I've put a bunch of "a's" in there to give enough time to test releasing the CTRL+SHIFT before/during/after the writing of them)
      HotKeySet("^+t", "WriteTxt") Func WriteTxt() WinWaitActive("Untitled - Notepad") $var = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" send($var, 1) EndFunc While 1 Sleep(500) WEnd Thanks guys!
    • Darien
      By Darien
      Hello,
       
      I found a bug in the statement "ContinueLoop". Run the following script:
       
      For $a = 1 To 3
          MsgBox(0, "The value of $a is:", $a)
          For $i = 1 To 10
              MsgBox(0, "The value of $i is:", $i)
              If $i = 5 Then ContinueLoop 2
          Next
          ; command
      Next