Sign in to follow this  
Followers 0
sunlord

Array question

5 posts in this topic

Is there any way to return the contents of a particular element in an Array? For example if I type in 3 in an Input box, I should get the contents of the 3rd element in the Array.

Share this post


Link to post
Share on other sites



Is there any way to return the contents of a particular element in an Array? For example if I type in 3 in an Input box, I should get the contents of the 3rd element in the Array.

Dim $aArray[4] = ['Nothing','Really','Special','Here']
$nNum = InputBox('Number', 'Enter a number between 0 and 3', '', '', 100, 80)
If @error Then Exit
MsgBox(64, 'Info', '$aArray[' & $nNum & '] = ' & $aArray[$nNum])

[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

Thanks!

Share this post


Link to post
Share on other sites

Dim $aArray[4] = ['Nothing','Really','Special','Here']
$nNum = InputBox('Number', 'Enter a number between 0 and 3', '', '', 100, 80)
If @error Then Exit
MsgBox(64, 'Info', '$aArray[' & $nNum & '] = ' & $aArray[$nNum])

How do you get the 'If @error Then Exit' to work?

john

Share this post


Link to post
Share on other sites

Failure: Returns "" (blank string) and sets @error as follows:

@Error 0 = The string returned is valid.

1 = The Cancel button was pushed.

2 = The Timeout time was reached.

3 = The InputBox failed to open. This is usually caused by bad arguments.


[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