Jump to content

Reading from a text file


Recommended Posts

Hi, new to Autoit and I would like to ask for some help from the experienced users here. I would like to read a text file with various number data line by line, and iterate through the values one by one pressing keyboard combinations based on the input given. Could somebody give me any hints on how I could do this? 

keyboard.png

Link to comment
Share on other sites

  • Moderators

@DankeronisPalace welcome to the forum. To begin, look at FileRead and FileReadToArray in the help file. Both have great examples you should be able to modify to your needs.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Untested but something like:

Local $aFileLine, $aFileLines = FileReadToArray("<FilePath>")
Local $iLineCount = @extended
    If @error Then Exit
For $i = 0 To $iLineCount
    $aFileLine = StringSplit(StringStripWS($aFileLines[$i], 4), " ")
    If @error Then ContinueLoop
    For $j = 1 To $aFileLine[0]
        ;~ Do whatever for each number in the array
    Next
Next

 

Link to comment
Share on other sites

2 minutes ago, Subz said:

Untested but something like:

Local $aFileLine, $aFileLines = FileReadToArray("<FilePath>")
Local $iLineCount = @extended
    If @error Then Exit
For $i = 0 To $iLineCount
    $aFileLine = StringSplit(StringStripWS($aFileLines[$i], 4), " ")
    If @error Then ContinueLoop
    For $j = 1 To $aFileLine[0]
        ;~ Do whatever for each number in the array
    Next
Next

 

Thank you very much! I'll test it and make the appropriate changes to get it to work.

Link to comment
Share on other sites

  • Moderators

@DankeronisPalace if you have questions moving forward please ask, and post your code. Though you wouldn't always know it, we try to encourage people learning and asking questions rather than being spoon-fed code. :)

 

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...