Jump to content
Sign in to follow this  

My msgbox keeps repeating!

Recommended Posts


Hey Forum, 

I'm a real programming/AutoIT newbie. I've only been doing either for about 6 months, but with a lot of time spent in the help file and some really good people here I've written the script I needed. It works, but there is one issue. I have a message box set to confirm whether a task was completed successfully or not. The problem is after the script has run successfully I still get 3-4 more instances of the "failure" message. I'm not even sure if I explained this well in words let alone how to fix it. Here is a bit of my script. I'm sure there are a billion better ways to do what I did, but this worked for me and I understood why it worked. Thanks for the help!!!


#cs ----------------------------------------------------------------------------

    AutoIt Version:
    Author:         myName

    Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

; Read a list of computer names from a text file on local machine.

Global Const $sCompListFile = @DesktopDir & "\NewComputers.txt"
Global $aCompList = FileReadToArray($sCompListFile)
Global Const $aDataDrv = "\\dktp434932\WLIQ_Class_Folders\Software_Install_Files"

If @error Then
    MsgBox(6, "File Error", "Could Not Open File", 5)
For $I = 0 To UBound($aCompList) - 1

; Copy files to computer names listed in text file read previously.

Func CopyFiles($CompList)
    Local Const $DOCS = "\\" & $CompList & "\C\Users\hesadmin\Documents\INSITE 101"
; Removes existing insite 101  folder
    $rtn00 = DirRemove($DOCS, 1)
    If $rtn00 = 0 Then
        MsgBox(0, "INSITE 101", "Directory Remove Failed", 5)
    ElseIf $rtn00 = 1 Then
        MsgBox(0, "INSITE 101", "Directory Remove Successful", 5)
    ;Copy Class files in the working directory to a new folder/directory called Scripts.
    DirCopy($aDataDrv & "\Documents\INSITE 101", $DOCS, $FC_OVERWRITE)
    If DirGetSize($DOCS) >= 0 Then
        MsgBox(0, "INSITE 101", "Copy Complete", 5)
    ElseIf DirGetSize($DOCS) = @error Then
        MsgBox(0, "INSTIE 101", "Copy Failed!", 5)


Share this post

Link to post
Share on other sites

Would it be better if while testing you use consolewrite instead of a msgbox? Also if you really need logging use a txt file in the future so you can see stuff even when the script has exited.

You also have in your script if the script is successful or not with msgboxes on both.

Share this post

Link to post
Share on other sites

Guys thanks for the suggestions! I have deleted other comp names out of my text file so the cell may still be there. 

I also think I will remove the msgbox for @error since I can always check the remote machine to see if anything has changed.

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.