Jump to content

Read a line of a file that contains


Recommended Posts

Can files be read from the web or the cloud?

I am trying to read this file but get the file open error.

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

;Assign the file path to a variable
Local $sFilePath = "C:\Automation\test.txt"
Local $sFilePathAzure ="https://batlgroupimages.blob.core.windows.net/files/test.txt"
Local $nLineNumberToLookFor = 0

;Open the file test.txt in append mode.
;If the folder C:\Automation does not exist, it will be created.
Local $hFileOpen = FileOpen($sFilePathAzure, $FO_APPEND + $FO_CREATEPATH)
;Display a message box in case of any errors.
If $hFileOpen = -1 Then
    MsgBox($MB_SYSTEMMODAL, "", "An error occurred while opening the file.")
EndIf

;Set the file position to beginning for reading the data from the beginning of the file.
FileSetPos($hFileOpen, 0, $FILE_BEGIN)

;Read the data from the file using the handle returned by FileOpen
;Local $sFileRead = FileRead($hFileOpen)
;Read the 2nd line of data from the file using the handle returned by FileOpen
Local $sFileReadLine = FileReadLine ($hFileOpen,2)
;Close the handle returned by FileOpen.
FileClose($hFileOpen)

 

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

×
×
  • Create New...