Jump to content

Recommended Posts

Posted

CODE
;679, 708,679, 645,742, 582,742, 582,679, 582

;679, 645,679, 582,742, 519,742, 519,679, 519

#include <Array.au3>

#include <File.au3>

Dim $csvArray

$csvFile = "C:\array.txt"

If FileExists($csvFile) Then

If Not _FileReadToArray($csvFile, $csvArray) Then

MsgBox(0,"Error","Error reading " & $csvFile)

Else

For $x = 1 To $csvArray[0] - 1

$csvLine = $csvArray[$x]

$csvLineArray = StringSplit($csvLine, ",", 1)

$x1 = $csvLineArray[1]

$y1 = $csvLineArray[2]

$x2 = $csvLineArray[3]

$y2 = $csvLineArray[4]

$x3 = $csvLineArray[5]

$y3 = $csvLineArray[6]

$x4 = $csvLineArray[7]

$y4 = $csvLineArray[8]

$x5 = $csvLineArray[9]

$y5 = $csvLineArray[10]

If PixelGetColor($x1, $y1) = 16711680 And PixelGetColor($x2, $y2) = 16711680 And PixelGetColor($x3, $y3) = 16711680 Then

MouseClick("left", $x4, $y4, 1, 50)

MouseClick("left", $x5, $y5, 1, 50)

EndIf

Next

EndIf

EndIf

The error

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Administrator\My Documents1test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>12:03:19 Starting AutoIt3Wrapper v.1.9.2

>Running AU3Check (1.54.7.0) from:C:\Program Files\AutoIt3

+>12:03:19 AU3Check ended.rc:0

>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Administrator\My Documents1test.au3"

C:\Documents and Settings\Administrator\My Documents1test.au3 (19) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$y1 = $csvLineArray[2]

$y1 = ^ ERROR

->12:03:20 AutoIT3.exe ended.rc:1

+>12:03:21 AutoIt3Wrapper Finished

>Exit code: 1 Time: 1.868

Posted

Well one of the lines in array.txt has no , in it.

Thats my guess, put a copy of the array.txt before I can look more into it.

Here is all that is in it to start with and it did work with different number before....

679,708,679,645,742,582,742,582,679,582

679,645,679,582,742,519,742,519,679,519

Posted (edited)

Try this

;679, 708,679, 645,742, 582,742, 582,679, 582
;679, 645,679, 582,742, 519,742, 519,679, 519
#include <Array.au3>
#include <File.au3>
Dim $csvArray
$csvFile = "C:\array.txt"

If FileExists($csvFile) Then
If Not _FileReadToArray($csvFile, $csvArray) Then
MsgBox(0,"Error","Error reading " & $csvFile)
Else
For $x = 1 To $csvArray[0] - 1
ConsoleWrite($x)
$csvLine = $csvArray[$x]
ConsoleWrite($csvLine)
$csvLineArray = StringSplit($csvLine, ",", 1)

$x1 = $csvLineArray[1]
$y1 = $csvLineArray[2]
$x2 = $csvLineArray[3]
$y2 = $csvLineArray[4]
$x3 = $csvLineArray[5]
$y3 = $csvLineArray[6]
$x4 = $csvLineArray[7]
$y4 = $csvLineArray[8]
$x5 = $csvLineArray[9]
$y5 = $csvLineArray[10]

If PixelGetColor($x1, $y1) = 16711680 And PixelGetColor($x2, $y2) = 16711680 And PixelGetColor($x3, $y3) = 16711680 Then
MouseClick("left", $x4, $y4, 1, 50)
MouseClick("left", $x5, $y5, 1, 50)
EndIf

Next
EndIf
EndIf

And then tell me the output - And be sure that there are no ekstra "returns - lines" in the text file

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Posted

Try this

;679, 708,679, 645,742, 582,742, 582,679, 582
;679, 645,679, 582,742, 519,742, 519,679, 519
#include <Array.au3>
#include <File.au3>
Dim $csvArray
$csvFile = "C:\array.txt"

If FileExists($csvFile) Then
If Not _FileReadToArray($csvFile, $csvArray) Then
MsgBox(0,"Error","Error reading " & $csvFile)
Else
For $x = 1 To $csvArray[0] - 1
ConsoleWrite($x)
$csvLine = $csvArray[$x]
$csvLineArray = StringSplit($csvLine, ",", 1)


Copied the same numbers into a new text file and it WORKED but why did the other text  file stop when all I did was change the numbers? The OLD one still doesn't work....

$x1 = $csvLineArray[1]
$y1 = $csvLineArray[2]
$x2 = $csvLineArray[3]
$y2 = $csvLineArray[4]
$x3 = $csvLineArray[5]
$y3 = $csvLineArray[6]
$x4 = $csvLineArray[7]
$y4 = $csvLineArray[8]
$x5 = $csvLineArray[9]
$y5 = $csvLineArray[10]

If PixelGetColor($x1, $y1) = 16711680 And PixelGetColor($x2, $y2) = 16711680 And PixelGetColor($x3, $y3) = 16711680 Then
MouseClick("left", $x4, $y4, 1, 50)
MouseClick("left", $x5, $y5, 1, 50)
EndIf

Next
EndIf
EndIf

And then tell me the output

Posted

Copied the same numbers into a new text file and it WORKED but why did the other text file stop when all I did was change the numbers? The OLD one still doesn't work....

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Administrator\My Documents3.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>12:27:30 Starting AutoIt3Wrapper v.1.9.2

>Running AU3Check (1.54.7.0) from:C:\Program Files\AutoIt3

+>12:27:30 AU3Check ended.rc:0

>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Administrator\My Documents3.au3"

123C:\Documents and Settings\Administrator\My Documents3.au3 (20) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$y1 = $csvLineArray[2]

$y1 = ^ ERROR

->12:27:30 AutoIT3.exe ended.rc:1

+>12:27:31 AutoIt3Wrapper Finished

>Exit code: 1 Time: 1.418

Posted

You must have some "extra" empty lines in your old text file...

123C:\Documents and Settings\Administrator\My Documents3.au3 (20) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

You see the array loops 3 times = 3 lines (at minimum)

Try this and it should show what i mean.

#include <Array.au3>

#include <File.au3>

Dim $csvArray

$csvFile = "C:\array.txt"

If FileExists($csvFile) Then

If Not _FileReadToArray($csvFile, $csvArray) Then

MsgBox(0,"Error","Error reading " & $csvFile)

Else

_ArrayDisplay($csvArray, "Display Array")

EndIf

EndIf

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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
×
×
  • Create New...