Jump to content

Recommended Posts

Posted (edited)

#include <file.au3>
Dim $aRecords
If _FileReadToArray("all.lst",$aRecords) < 8 Then
   _FileWriteFromArray("all3.lst",$aRecords)
   Exit
EndIf

this just copys the file but what i want it to do is only copy if the line has 8 or more characters

Edited by acana007
Posted (edited)

#include <file.au3>
Dim $aRecords
FileRead("all.lst")
If @extended > 8 Then
 _FileWriteFromArray("all3.lst",$aRecords)
EndIf

Edited by dmob
Posted

this just copys the file but what i want it to do is only copy if the line has 8 or more characters

If you meant copy the whole file if it has 8 or more lines:
#include <file.au3>

Dim $aRecords
_FileReadToArray("all.lst", $aRecords)
If @error = 0 And $aRecords[0] >= 8 Then _FileWriteFromArray("all3.lst", $aRecords, 1)

If you meant copy each line, if it has 8 or more characters:

#include <file.au3>

Dim $aRecords
_FileReadToArray("all.lst", $aRecords)
If @error = 0 Then
    For $n = 1 To $aRecords[0]
        If StringLen($aRecords[$n]) >= 8 Then FileWriteLine("all3.lst", $aRecords[$n])
    Next
EndIf

Else explain what you really meant.

:mellow:

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
Posted

ok i want the script to copy the lines that are in that file that have 8 characters or more to the new file if it has less then 8 characters then skip them

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
  • Recently Browsing   0 members

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