Jump to content
Sign in to follow this  

Reading a .txt and displaying its contents in a messagebox

Recommended Posts



I'm sorry , I know this is a really basic question and I feel like an idiot for asking. I am currently writing a script that scans network machines, to check if cetain folders on the machine are populated with files(It lets us know if our ftp service is working correctly). I currently have it set up to add the name of the machine to a txt file if it cannot connect, and same if it can connect but the folder is poulated with 10 or more files. After it is done scanning the machines I want it to read these temporary txt files and display a box that says "Summary: [Enter] Cannot Connect to: [Enter] (then display the names from the text file [Enter] [Enter] Ftp service not active: [Enter] then display the names from the other file.

One problem that I have run into is that most of the time ther is no ftp problems so one of the txt files is not created.

#Include <File.au3>
#Include <Array.au3>
FileInstall("C:\Documents and Settings\OvittKe\My Documents\scripts\ADR\Names.txt", @ScriptDir & "\", 0)
$count = 0
$PC_File = FileOpen("Names.txt",0)
ProgressOn("ADR FTP SCAN", "Percent Complete", "Progress",1,16)
    $Line_Number = _FileCountLines("Names.txt")
    $Percent = ($count / $Line_Number) * 100
While True
        $Percent = ($count / $Line_Number) * 100
        $CompName = FileReadLine($PC_File)
            If @error = -1 Then
                $count = $count+1
        $Files = _FileListToArray("\\"&$CompName&"\c$\adr\data")
        If @error = 1 Then
            $Files_Re = _FileListToArray("\\"&$CompName&"\c$\adr\data")
                If @error = 1 Then
                    $PingValue = ping($compName) 
                    If $PingValue = 0 Then
                        FileWriteLine ("Unable.txt", $CompName & @CRLF)
            If @error <> 4 Then
                If $Files[0] >= 10 Then
                    FileWriteLine("FTPerror.txt", $CompName & @CRLF)

SoundPlay(@WindowsDir & "\media\tada.wav",0)
;$C_error = FileRead("Unable.txt")
;$FTP_error = FileRead("FTPerror.txt")
;MsgBox("Complete","The Scan has succesfully been completed." & @CRLF & "Summary:" & @CRLF & "Unable to connect to computers:" & @CRLF & $C_error & @CRLF & @CRLF & "Not Performing FTP Services:" & @CRLF & $FTP_error )

At the bottom I have attempted this and failed..

Please help! It is much appreciated!

Thanks! :)


I figured it out.. Thanks anyway :P

Edited by Kovitt

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.