Jump to content
Sign in to follow this  
iceberg

Text file to MsgBox

Recommended Posts

iceberg

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
themax90

#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
LxP

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
Valuater

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
iceberg

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.