bt707
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,
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,
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(strSource Folder)
Here is what I tried
'=========================
strSourceFolder = Replace(WScript.ScriptFull Name, WScript.ScriptName, "") & "D:\temp\test"
strTargetFolder = Replace(WScript.ScriptFull Name, 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.Fi leSystemOb ject")
Set objSourceFolder = objFSO.GetFolder(strSource Folder)
Set objShell = CreateObject("Shell.Applic ation")
Set objTargetFolder = objShell.NameSpace(strTarg etFolder)
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,
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(strSource
Here is what I tried
'=========================
strSourceFolder = Replace(WScript.ScriptFull
strTargetFolder = Replace(WScript.ScriptFull
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.Fi
Set objSourceFolder = objFSO.GetFolder(strSource
Set objShell = CreateObject("Shell.Applic
Set objTargetFolder = objShell.NameSpace(strTarg
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(strSource Folder)
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.
Set objSourceFolder = objFSO.GetFolder(strSource
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.
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,
The box give me this for the path.
Source folder is:
D:\TEMP\D:\temp\test\
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, I see now. That fixed it. Learned a few new things here.
Works very well now.
Thank you very much.
Works very well now.
Thank you very much.
No problem at all. Thanks for the grade.
Regards,
Rob.
Regards,
Rob.
https://www.experts-exchange.com/questions/23213819/Show-winodws-progress-bar-when-copying-files.html
Regards,
Rob.