Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

asked on

msgbox for progress

Is there a way to create a msgbox in a vbs script to show the progress of a action.

For example:

If I had something in the such as copying a very large file somewhere that would take 5 or 10 minutes, can a msgbox come up while it is working, then close and continue. Don't want a box to come up where you have to click OK to close it and continue.

Thanks,

Avatar of RobSampson
RobSampson
Flag of Australia image

Hi, this should do it.  It shows the standard windows progress bar:
https://www.experts-exchange.com/questions/23213819/Show-winodws-progress-bar-when-copying-files.html

Regards,

Rob.
Avatar of bt707

ASKER

Hi Rob,

I tried that but did not work, getting a error path not found for some reason, I have the correct paths in and full rights to those directories. Do you have any idea why I would get a path not found error, it's coming from this line.
Set objSourceFolder = objFSO.GetFolder(strSourceFolder)

Here is what I tried

'=========================
strSourceFolder = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "D:\temp\test"
strTargetFolder = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "D:\temp\test2"
 
If Right(strSourceFolder, 1) <> "\" Then
        strSourceFolder = strSourceFolder & "\"
End If
If Right(strTargetFolder, 1) <> "\" Then
        strTargetFolder = strTargetFolder & "\"
End If
 
Const FOF_CREATEPROGRESSDLG = &H10&
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
Set objSourceFolder = objFSO.GetFolder(strSourceFolder)
Set objShell = CreateObject("Shell.Application")
Set objTargetFolder = objShell.NameSpace(strTargetFolder)
If Not objTargetFolder Is Nothing Then
        'MsgBox "Copying " & objSourceFolder.Path & " to " & strTargetFolder
       
        objTargetFolder.CopyHere objSourceFolder.Path, FOF_CREATEPROGRESSDLG
Else
        MsgBox "There was an error finding " & strTargetFolder
End If
MsgBox "Done"
'==================


Thanks,
Hmmm, no not really....above that line
Set objSourceFolder = objFSO.GetFolder(strSourceFolder)

put this
strSourceFolder = InputBox("Source folder is:", "Source Folder", strSourceFolder)

and then see if you can copy and paste that path to a Windows --> Run box and find it....

Regards,

Rob.
Avatar of bt707

ASKER

That is the problem, probably a easy one for you but I'm not sure what to fix.

The box give me this for the path.

Source folder is:
D:\TEMP\D:\temp\test\

Thanks,


ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt707

ASKER

OK, I see now. That fixed it. Learned a few new things here.
Works very well now.

Thank you very much.
No problem at all. Thanks for the grade.

Regards,

Rob.