Sign in to follow this  
Followers 0
Furax

Array Index Display Problem

3 posts in this topic

#1 ·  Posted (edited)

Greetings,

Thank you for looking at this. I am pretty new to scripting and there is something I cannot figure out. I have attempted to write an internet explorer bot that collects data and returns it into an array. However, the array doesn't seem to display the data when using indexes with the _ArrayDisplay function. The data is captured using string functions.

Here are a few lines of code isolating the problem. $avArray[0] is not showing the letter c as expected.

#include <Array.au3>
#include <String.au3>

Dim $avArray[2]
$string = _StringBetween('welcome', 'wel','ome', -1)

$avArray[0] = $string
$avArray[1] = "Where is the letter c?"

_ArrayDisplay($avArray, "Show me")

I would see the letter c if I used the code below instead but then the array will not display the other indexes.

_ArrayDisplay($avArray[0], "Show me")

The code below would solve the problem but i'm hoping for an alternative as I would like to keep the clip available for other things. There has to be a better way.

_ArrayToClip ($string)
$avArray[0] = ClipGet()

I am looking to learn Autoit and I would greatly appreciate if you could point me in the right direction or perhaps provide an explanation. I have searched the help files and the forums on many occasions but I must be missing the obvious. I do apologize for it.

Thank you for your time.

Edited by Furax

Share this post


Link to post
Share on other sites



You need to tell the script what dimension it is meant to be reading... :)

#include <Array.au3>
#include <String.au3>

Dim $avArray[2]
$string = _StringBetween('welcome', 'wel','ome', -1)

$avArray[0] = $string[0]
$avArray[1] = "Where is the letter c?"

_ArrayDisplay($avArray, "Show me")

Oh, and welcome to the forums ;)

Share this post


Link to post
Share on other sites

Thanks for the quick reply Bert. Now I can see a good use for StringLen!

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