HEMICharger
IS-IT--Management
I'll first apologize for my lack of knowledge on this subject. I put together a script using examples I found else where, so I'm pretty sure this is not the most efficient way to do what I want.
My program (running on Win Server 2003) creates a video file with the same name every time. We will use "video.wmv" as the example. I need to allow the user to enter a new name for this file, and have the script move it to another location.
The script I have works by renaming and moving the file. But if the original file doesn't exist, it just bombs out with an error. How can I make it so if the original video file doesn't exist, it will end the script with a dialog box saying "file doesn't exist" instead of an error?
Here is what I have:
My program (running on Win Server 2003) creates a video file with the same name every time. We will use "video.wmv" as the example. I need to allow the user to enter a new name for this file, and have the script move it to another location.
The script I have works by renaming and moving the file. But if the original file doesn't exist, it just bombs out with an error. How can I make it so if the original video file doesn't exist, it will end the script with a dialog box saying "file doesn't exist" instead of an error?
Here is what I have:
Code:
Do While X = 0
strAnswer = InputBox _
("Please enter a name for your video file:","Create File")
If strAnswer = "" Then
Wscript.Echo "You must enter a file name."
Else
Wscript.Echo strAnswer
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\video\video.wmv" , "C:\archive\" & strAnswer & ".wmv"
Exit Do
End If
Loop