SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 751 | Next

David A. Karp

"Windows Vista Annoyances: Tips, Secrets, and Hacks"

If the folder
doesn??™t exist and the user doesn??™t want to try again, the user can exit; always
give your users a choice to get out if they want.
Because the script implements some degree of error checking, the line On
Error Resume Next appears at the beginning of the script. This statement
Example 9-2. Quick and dirty backup tool
On Error Resume Next
TargetDrive = "K"
Accepted = False
Do Until Accepted
MyFolder = InputBox("Please enter the name of the folder_
you want to back up.")
If Not FolderExists(MyFolder) Then
Answer = MsgBox("The folder you typed doesn't exist._
Try again?", 36, "")
If Answer = 7 Then WScript.Quit
Else
Accepted = True
End If
Loop
Answer = MsgBox("Please get drive " & TargetDrive & ": ready.", 33, "")
If FolderSize(MyFolder) > DriveFreeSpace(TargetDrive) Then
MsgBox "The folder you specified won't fit on this drive.", 16
WScript.Quit
End If
If FolderCreate(TargetDrive & ":\Backup\") = False Then
MsgBox "There was a problem writing to drive " & TargetDrive & ":.", 16
WScript.Quit
End If
Call FolderCopy(MyFolder, TargetDrive & ":\Backup\")
If Right(MyFolder, 1) <> "\" Then MyFolder = MyFolder & "\"
Call WriteToFile(MyFolder & "backuplog.txt",_
"Last backed up: " & Now)
548 | Chapter 9: Scripting and Automation
instructs WSH to simply ignore any errors it finds. This doesn??™t automatically
resolve any errors; it just eliminates the error message that would otherwise
appear in the event of an error, allowing the script to skip problems and
continue uninterrupted.


Pages:
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6