Jump to content

Read all lines of file excluding first one


NoizeBit
 Share

Recommended Posts

#include <MsgBoxConstants.au3>
Global $Skipline = 0 ;0==> first line

Example()


Func Example()
    ; Read the current script file into an array using the filepath.
    Local $aArray = FileReadToArray(@ScriptFullPath)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file.
    Else
        Local $temprf
        For $i = 0 To UBound($aArray) - 1 ; Loop through the array.
            If $Skipline = $i Then ContinueLoop
            $temprf &= $aArray[$i]
        Next
    EndIf
    MsgBox(0, 0, $temprf)
EndFunc   ;==>Example

 

Link to comment
Share on other sites

#include <MsgBoxConstants.au3>
Global $Skipline = 0 ;0==> first line

Example()


Func Example()
    ; Read the current script file into an array using the filepath.
    Local $aArray = FileReadToArray(@ScriptFullPath)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file.
    Else
        Local $temprf
        For $i = 0 To UBound($aArray) - 1 ; Loop through the array.
            If $Skipline = $i Then ContinueLoop
            $temprf &= $aArray[$i]
        Next
    EndIf
    MsgBox(0, 0, $temprf)
EndFunc   ;==>Example

 

Awesome, just what I was looking for. Thanks a bunch, Celtic88 ;)

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