|
Getting Started with Batch Rename .EXE Scripting
by: unknown - (Submit your own tutorials to tutorials@stintercorp.com)
Learn the basic code to begin renaming files through the advanced scripting features of Batch Rename .EXE. The scripting features provide you with all the power of VB Script in a manner dedicated to renaming your files.
This tutorial will teach you how to:
1. Add Prefixes to file Names via Scripting
2. Add Suffixes to file Names via Scripting
3. Working with Number (adding a File number) via Scripting
4. Creating Condition Formatting Rules (If... Then.. ElseIf... Else... End If.)
5. Learning to us the My Functions Wizard.
Tutorial 1: Adding Prefixes:
Once in the scripting editor window we want to erase ever thing listed there. Then we want to enter the very simple code below.
| strFilename = "MyPrefix_" & strFilename |
You'll now notice the file name preview window will show all our filenames with the text "MyPrefix_ ". That is all that is needed to add prefixes to the filename. (Look: Notice how the & 'ampersand' is used to join the "MyPrefix_" string and the strFilename variable together - whenever you want to join two things together always use the '&'.)
A more complex Example:
| strFilename = "New_" & "MyPrefix_" & "Photo_" & strFilename |
We've now just combined three strings together and placed them in front of the original filename. Our files will now be named "New_MyPrefix_Photo_{originalfile}.{extension}. Feel free to play around with other variations.
Tutorial 2: Adding Suffixes:
Once in the scripting editor window we want to erase ever thing listed there. Then we want to enter the very simple code below.
| strFilename = strFilename & "_MySuffix" |
You'll now notice the file name preview window will show all our filenames with the {original filename} followed by the text "_MySuffix " then the file extension. You'll notice that Batch Rename .EXE was kind enough to add the Suffix to the back of the filename, not the extension - otherwise we would have ended up with something like "myphoto.jpg_MySuffix" which change the file extensions type; cause our image to no longer be supported in windows. (Look ahead: If you did want to modify the extension of the file, you can easy do so by modifying the strExtension variable. ex. strExtension = ".jpeg"
A more complex Example of using Prefixes (Tutorial 1) and Suffixes (Tutorial 2):
| strFilename = "New_" & strFilename & "_WaterFront" |
We've now created a script that will change the file 'myPhoto.jpg" into: New_myPhoto_WaterFront.jpg.
More to follow.......
<< You have reached the end of this tutorial >>
|