Sign in to follow this  
Followers 0
Noobster24

Find max index number in array

4 posts in this topic

#1 ·  Posted (edited)

Hi,

i got this array: $Links1 or $Links2 or $Links3 and i want to find the max index number.

Like this:

$Links1[0] = 'hi'

$Links1[1] = 'hadf'

$Links1[2] = 'adsfdsfhi'

$Links1[3] = 'dfljaleuhi'

So i want to get the number 3...

I checked the helpfile for _ArrayMaxIndex and _ArrayMax but they doesn't give me the result i want, i'm probably coding it wrong :lmao:...

Like this example:

#include <Array.au3>

Dim $Links1[4]
$Links1[0] = 'hi'
$Links1[1] = 'hadf'
$Links1[2] = 'adsfdsfhi'
$Links1[3] = 'dfljaleuhi'

MsgBox(0,'Max Index String value',_ArrayMaxIndex( $Links1, 0, 0))
MsgBox(0,'Max Index String value',_ArrayMaxIndex( $Links1, 0, 1))
MsgBox(0,'Max Index Numeric value',_ArrayMaxIndex( $Links1, 1, 0))
MsgBox(0,'Max Index Numeric value',_ArrayMaxIndex( $Links1, 1, 1))
MsgBox(0,'Max String value',_ArrayMax( $Links1, 0, 1))
MsgBox(0,'Max Numeric value',_ArrayMax( $Links1, 1, 1))
MsgBox(0,'Max Numeric value',_ArrayMax( $Links1, 1, 0))
MsgBox(0,'Max Numeric value',_ArrayMax( $Links1, 0,0))
It doesn't give me the 3 :ph34r:

What am i doing wrong?

Edited by Noobster24

Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.

Share this post


Link to post
Share on other sites



UBound() doesn't work for you?

Dim $Links1[4]
$Links1[0] = 'hi'
$Links1[1] = 'hadf'
$Links1[2] = 'adsfdsfhi'
$Links1[3] = 'dfljaleuhi'
MsgBox(64, 'Info', 'The total elements are: ' & UBound($Links1) - 1)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

UBound() doesn't work for you?

Dim $Links1[4]
$Links1[0] = 'hi'
$Links1[1] = 'hadf'
$Links1[2] = 'adsfdsfhi'
$Links1[3] = 'dfljaleuhi'
MsgBox(64, 'Info', 'The total elements are: ' & UBound($Links1) - 1)
Damn, you're a genious right? :lmao:

Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Damn, you're a genious right? :lmao:

Yeah, my genious plaque is right next to my jerk of the year award :geek::ph34r: Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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
Sign in to follow this  
Followers 0