Sign in to follow this  
Followers 0
beowuf

multidimensional array in function

5 posts in this topic

Hello,

I'm new in Autoit, and I decided today that i will create some functions.

My problem is, i have 3 arrays:

dim $OK[2][100]

dim $JustInQS[2][100]

dim $JustInXML[2][100]

In these arrays are data, i want to copy into an excel sheet.

I want to do it with the following function:

Func pastetable(ByRef $tablename)

switchtodestination()

for $j=0 To 9 Step 1

$temp=$tablename[0][j]

Send($temp)

Send("{RIGHT}")

$temp=$tablename[1][j]

Send($temp)

Send("{LEFT}{DOWN}")

next

EndFunc

In the future I want to call these like:

pastetabel($OK)

pastetable($JustInQS)

pastetable($JustInXML)

In this time i always get an error even if it is not called, just the function is there.The error is:

D:\Program Files\AutoIt3\bence\proba\ujkiertekel.au3(29,24) : ERROR: syntax error

$temp=$tablename[0][j]

~~~~~~~~~~~~~~~~~~~~~^

D:\Program Files\AutoIt3\bence\proba\ujkiertekel.au3(32,24) : ERROR: syntax error

$temp=$tablename[1][j]

~~~~~~~~~~~~~~~~~~~~~^

D:\Program Files\AutoIt3\bence\proba\ujkiertekel.au3 - 2 error(s), 0 warning(s)

The line 29 and 32 are the lines i copied with the function earlier.

I think there should be some problems with the argument handling, but i don't know what.

Please help me in this!

Best regards

Bence

Share this post


Link to post
Share on other sites



Also, look at the Excel.au3 UDF and the _Excel* functions in the help file. Using Send() to apply data in Excel is going to be very unreliable. For example, _ExcelWriteSheetFromArray() will write an entire 2D array to the Excel sheet in one function call.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Try $j instead of just j :)

Thanks! :party::):idea:

That was my problem

Share this post


Link to post
Share on other sites

Also, look at the Excel.au3 UDF and the _Excel* functions in the help file. Using Send() to apply data in Excel is going to be very unreliable. For example, _ExcelWriteSheetFromArray() will write an entire 2D array to the Excel sheet in one function call.

:party:

Thank you for the idea!

I will check it now.

Originally i wanted to write my script as easy as it can be, that's why i used this solution.But i will change it when i will have time :)

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