However,
the first line uses the GetSpecialFolder function to obtain the location of the
SendTo folder from the Registry, which is handy if there??™s more than one
user account (each with its own SendTo folder), if you intend to use this
script on more than one computer, or if you don??™t want to have to modify
the script when Microsoft changes the location of the SendTo folder in the
next version of Windows (which it did for Vista, dontcha know).
Once the script has been written, you??™ll need to associate it with all file
types. See ???File Type Associations,??? in Chapter 3, for details on using the ???*???
file type (located in HKEY_CLASSES_ROOT\*).
This script requires the following subroutines, found earlier in this book:
CommandLine, GetSpecialFolder, and Shortcut.
Example 9-5. SendTo shortcut creator
SendToFolder = GetSpecialFolder("SendTo")
Call Shortcut("SendToFolder\Notepad.lnk", CommandLine(1))
Wacky Script Ideas | 551
Scripting and
Automation
Rename Files with Search and Replace
Although Explorer lets you rename more than one file at a time (as
described in Chapter 2), it??™s not terribly flexible or intuitive. The Command
Prompt provides a decent multiple-file renaming tool, but it??™s not always
convenient. Example 9-6 shows a script that will rename all the files in a
given folder based on rules you choose.
The first section of code is responsible for asking for input, including the
folder name, the text to look for, and the text with which to replace it.
Pages:
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768