|
|||||||||||
|
Lessons.The following lessons will show you how to work with all SR datatypes. To try these demos you will need sample files included to this distributive pack (if you installed the software to the default folder you will find them in "c:\program files\sophisticated rename\tutorial"). Lesson A. Constants and
counters.
Lesson-A. Constants
and counters. Add the files for lesson-A (see the 'tutorial' subfolder of the program) to the SR file list. Create an ascending counter from 1 to 32000. Set the number of digits = 3. Save the counter as "MYCOUNT". Press [Add item] in the main window (Template section), and add the counter to the template. Then add " - " as a constant. Now add "*XVR FILE NAME". The result will be something like that: asd.txt -> 001 - asd.txt
Lesson-B. Variables and extra variables. The task is to rename the files IMG_1650.JPG, IMG_2280.JPG,
IMG_2537.JPG using their metadata according to the template:
The task is to rename files for lesson-C in such a way: if the name contains digits, add zeros so that the length of the new name will be eight. If the name doesn't contain digits, do the same thing but with dashes instead of zeros (see table). The task is easy to solve. A conditional determines if there are digits in the name, and if there are some, it adds 7 zeros to the beginning of the name, otherwise it adds 7 dashes. A variable is created to limit the number of symbols to 8.
If you cannot achieve such a result yourself, load "preset-3" and learn how it works.
Beaver13 Apr 2001 beaver's hut - animals.jpg This is what we want to get: 2001-04-13 [Animals] Beaver (Beaver's Hut).jpg
Lessons-E, F and G. External variables. To understand this stuff read the comments in the source files ("external" subfolder). LESSON-E. Plugin for beginners ;-) It's easy to create such a plugin for the nonce. It will work only if you place it to the same folder where sr.exe is. This simple plugin just gathers modification date of a file and sends back 3 values: year, month, day. If you want to create a professional plugin for distribution, see lesson F example. LESSON-F. This example shows how to write
professional plugins for distribution. The code is more difficult
but it will work form any location, no matter where sr.exe is. This
plugin generates random sequences. It uses 3 keys: "cnt", "min" and
"max" to control the process. Examples: '110011110100101',
'651084312', 'ABCCBABBABBCA', 'ienmgus' and so on. LESSON-G. This task is more complicated. It is a kind of stepping counter when there will be a separate counter for each folder. It's just an example, if you need such a modification, it's better to use the internal SR counter. This example shows how to keep some data between executions of the program. A temporary buffer will be created for the nonce and at the end of processing it will be deleted. To determine the last execution of the program, we use *XVR LIST NUMBER and *XVR LIST TOTAL xvars. When they are equal, it means that it is the last file that is being processed. The only keyword is 'digits' that specifies the number of digits in the counter.
Lesson-H. Sorting files with "Custom paths" feature. Suppose you have a lot of digital photos with exif metadata (files for lesson-H in the tutorial folder; there you find only 4 files to reduce the size of the distributive). The structure of the file names is "location dash number": izmaylovo-23.jpg The task is to create a separate folder for each day of schooting using metadata and copy the files to these folders. The name of each folder should contain the shooting date and the location name and a filename should contain the location name and a 3-digit number: 2003-07-30 - Dacha This thing can be done using "custom paths" feature. All we have to do is add the required items to the template, dividing the folder items from the file items by the "\" symbol. In this example we create subfolders in the folder of original files ("*XVR FILE PATH"), but we can easily create them in some fixed place, providing an absolute path, for example "c:\sorted_files\". If you have any questions, open the "lesson-H" preset.
Lesson-I. Using folder/file name information to save ID3 tags for MP3 files. A user wrote once and described such a situation: he had numerous sorted mp3 files without ID3 tags. These tags are used to show the artist name and the song title when the file is played in a mp3 player such as WinAMP. He suggested to use SR vars to get this data from the folder/and file name structure. It can be done with the help of the ID3 Updater. All you have to do is specify vars according to your specific folder/file structure. For example, this is how many mp3 files are stored: \My Music\Alphaville\1997 Salvation\01 - Inside Out.mp3 Alphaville - artist; This structure will be used to show you the way you should proceed in the most general way. First, drag'n'drop the files for lesson-I to the form (see "tutorial" folder). You should drag the whole "My Music" folder, not just some files. The folder contains 3 artists and 5 albums, total 30 files (some files were removed because trial version can handle only 30 files at once - if you have already registered, you can process thousands of files using the same scheme). The sample files are empty - they don't have neither music data nor ID3 tags - we don't need any data right now (except correct file names), on the contraty, we want to save ID3 tags to these files. Now open "lesson-I" preset. It has an empty template because the only purpose of this preset is to keep information about variables. Call ID3 updater (F8). At the right-bottom corner of the window press a small "load" button. Select "lesson-I". The fields of ID3 editor will be filled with the names of the variables that are described in the preset. You can see that the ID3v2 part is turned off - it's just because you work with empty files at the moment and ID3v2 requires real mp3 files. So, click [Apply] in the ID3 Updater and go to ID3 Viewer to see that all these files have correct tags. Be creative - don't despond if you have another folder/file structure - all you have to do is adjust a few variables. If you have problems with it, feel free to contact Acritum support team.
Lesson-J. Using folder/file name information to saveEXIF tags for JPG files. Suppose you have a lot of logically sorted pictures and you want to add some information from the file and folder names to the exif record of all photos. This can be easily done in Exif Updater. Exif Updater supports all SR datatypes, so all you have to do is extract required data to SR conditions and variables. Here is an example. We have a collection of well-known pictures that can be found in museums. The pictures don't have exif at all but they are properly sorted: C:\Pictures Collection\The Hermitage\Paul Gauguin - Idol
(1898).jpg ImageDescription - picture name; ImageDescription = Idol To complete the task you have to specify vars for artist name, picture name, year, museum name and a couple of conditions to join year, "the property of" text and the name of the museum - you already know that it's all easy. Then go to Exif Updater and enter the names of vars right to Advanced Tags edit fields. As the jpg files don't have exif record at all, you will be able to add your new tags only in Exiv2 mode, so make sure that you have installed it. After it you can start the process and see results in any Exif viewer. If you don't get successful results, load "lesson-J" preset in the main window and lesson-J preset in the Exif Updater - you will be able to find out how it all works. The files for this lesson can be found in the Tutorial folder. |