Jump to content

Recommended Posts

Posted

Input:

1297813913,1368aks79

Code:

$Input = FileOpen ("C:\test.txt",0)

If $Input = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

$trackno = FileReadLine($Input)

$info = StringSplit($trackno, ",")

$track_number = $info[0]

$invoice_number = $info[1]

Send($track_number])

Output:

2

Does anyone see what I am doing wrong here?

Thank you.

  • Developers
Posted (edited)

Input:

1297813913,1368aks79

Code:

$Input = FileOpen ("C:\test.txt",0)

If $Input = -1 Then

    MsgBox(0, "Error", "Unable to open file.")

    Exit

EndIf

$trackno = FileReadLine($Input)

$info = StringSplit($trackno, ",")

$track_number = $info[0]

$invoice_number = $info[1]

Send($track_number])

Output:

2

Does anyone see what I am doing wrong here?

Thank you.

<{POST_SNAPBACK}>

$info[0] will contain the number of elements found

$info[1] is the first element (Track number)

$info[2] is the second element (Invoice number)

:(

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I use the function _FileReadToArray(). It takes the name of the file to convert and the name of the single-dimension array to store the data.

You will need to add " #include <file.au3> " to the beginning of your script; without quotes.

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...