Sign in to follow this  
Followers 0
iceberg

Text file to MsgBox

6 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

nice one LxP

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

thanks alot guys!!! all 3 methods work great!


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0