Jump to content

Text file to MsgBox


iceberg
 Share

Recommended Posts

Hi,

I need your kind assistance to do the following:

I have created a text file. And I wanna display A msgbox displaying all that is in the text file.

MsgBox(0, "Files Backed Up", $file1)

The code doesn't work though. I have searched the forum but not quite getting there.

Thanks.

mouse not found....scroll any mouse to continue.

Link to comment
Share on other sites

#include <File.au3>
Dim $File = "Text.txt", $Track = 1, $Information = ""
$Lines = _FileCountLines($File)
For $Track = 1 to $Lines Step 1
    $Information = $Information & " " & FileReadLine($File, $Track)
Next
MsgBox(0, $File & " Information", $Information)

Edited by AutoIt Smith
Link to comment
Share on other sites

And even simpler (assuming that $File1 contains the path to the file):

$File1 = 'C:\FilesBackedUp.txt'
MsgBox(0, 'Files Backed Up', FileRead($File1, FileGetSize($File1)))
Edited by LxP
Link to comment
Share on other sites

maybe like this

#include <String.au3>
dim $Clist

$C_Text_location = @ScriptDir & '\10-20-2005.txt'; place your file location here

c_display($C_Text_location)

MsgBox(0,"C List", $Clist) 



Func c_display( $C_Text_location)
    
    Local $Cfile, $Cchars
    
    $Cfile = FileOpen($C_Text_location, 0)
; Check if file opened for reading OK
    If $Cfile = -1 Then
        MsgBox(0, "Error", "Unable to open C list   " )
        Exit
    EndIf
; Read in 1 line at a time until the EOF is reached
    While 3
        $Cchars = FileReadLine($Cfile)
        If @error = -1 Then ExitLoop
        
        $Clist = $Clist & $Cchars & @CRLF
        
    Wend
    FileClose($Cfile)
    
EndFunc

8)

NEWHeader1.png

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