AutoIt script turns off, because of array is out of bound

1 post in this topic

SorryButImaNewbie 36

I wrote a little script to automate some of my work (for which I'm greatfull).

I have little problem now. My script get data of currency values from specified time period. The problem, if XY day is a holiday or something, then the bank doesn't have new values for that day, thus my script can ask for "till that date" if there is only data for "till that date-1".

I should be done with this for tomorrow and I should learn for my test paper tomorrow, make a genetic algorhytm homework, and at least look at a ppt...

My idea/goal (with the If @error then... after @SZAMLATELJolvaso part) is that if this happens, I want it to automaticly jump to the last date of the array (I will be able to write something more elaborate, but for now thats my goal, to save the sinking ship )

Sign in

Similar Content

I have a script that takes a large excel file, pulls out and reorganizes certain information I need, and spits out a trimmed down csv file which I uses to upload the information on my website. Some of this information contains characters with accents or em dashes. By default it would create a csv file in ANSI which I then uploaded but had to tell my website import system it was windows-1252 in order for it to look correct.
This was all working fine except now I need to add in a non-breaking space and non-breaking hyphen into parts of my output. At first I tried using ChrW(0xA0) and ChrW(0x2011) as replacements. A quick test in the console looked correct, however opening the csv output in notepad++ showed the space correctly but a ? for the hyphen and the file was still encoded as ANSI. I tried to view it as UTF-8 instead but this just made the space appear as xAO and also other characters appeared that way like my em dashes appeared as x97 and another symbol as xA7 etc.
If I instead do a convert to UTF-8 from notepad++ then those problems go away except the hyphen still displays as ?. I then noticed on the page I linked for the non-breaking hyphen it lists the UTF-8 hex as 0xE2 0x80 0x91 (e28091). I was unsure how to enter this in autoit but several things i tried all failed to get the hyphen inserted.
I need a way to get both the space and hyphen added correctly as either ANSI or UTF-8, but if it is UTF-8 then I need a way to convert all of the other data I extracted from the excel file.
I've included a test excel file with a single line and test script to create a csv demonstrating the problem.
test.xlsx
test.au3

So I have a loop that keeps reading data from an array and searching it for the same value. If the value is no there it does work then adds the value to the array to prevent it from doing the same work.
If _ArraySearch($ID,$filearray[$i]) = -1 Then
Work....
_ArrayAdd($ID,$filearray[$i])
EndIf
This is in a for loop hence $i
So what is happening is the code works great for several hours. After a period of time _ArraySearch($ID,$filearray[$i]) will result in -1 even if $ID = $filearray. So it ready as if there is no data in the array. Anyone have this problem?

Also I am just running in using F5 not compiling it and running it if that makes a difference.

I am reading a CSV file which is tab seperated as below.
Local $aArray = FileReadToArray($file)
And now, I am splitting this main array record wise so that Array contains internally another arrow to represent each row.
For $i = 0 to (UBound($aArray) - 1)
;MsgBox(0,"",$aArray[$i])
$aArray[$i] = StringSplit(StringStripCR($aArray[$i]), Chr(9),2);Chr(9) for tab
;_ArrayDisplay($aArray[$i])
Next
Afther that, _ArrayDIsplay is able to see the individual internal arrays.
_ArrayDisplay($aArray[1])
But If I try to access the individual element of it as below.It is not showing any result.
MsgBox(0,"",$aArray[1][1])
Any suggestion, below is the sample csv file.
New Text Document.csv