CONVERSION


The TO action has the capability to convert the selected characters to decimal or hexadecimal numbers, and decimal or hexadecimal numbers to their corresponding ASCII characters.
This can be achieved with the use of the keywords below enclosed in asterisks (*) :

CHR : Converts selected numeric data to ASCII characters.
[:]HEX[<n>] : Converts characters or decimal numbers to hexadecimal numbers.
[:]DEC[<n>] : Converts characters or hexadecimal numbers to decimal numbers.

HEX and DEC can be followed by a number to indicate the number of formatting digits that the resulting numbers will have.
HEX and DEC can also be preceded by a colon (:) to indicate that even selected numeric data will be treated as ASCII characters.
Any characters outside the asterisks are treated as padding characters.

Examples:

SRename "filename" TO "%*hex*"
"filename" renamed as "%66%69%6C%65%6E%61%6D%65"

Converts the entire filename to hexadecimal byte values.


SRename "filename" MATCH "name" TO "%*hex*"
"filename" renamed as "file%6E%61%6D%65"

Converts string "name" to hexadecimal byte values.


SRename "filename" TO "+*dec*"
"filename" renamed as "+102+105+108+101+110+97+109+101"

Converts the entire filename to decimal byte values.


SRename "filename" TO "+*dec3*"
"filename" renamed as "+102+105+108+101+110+097+109+101"

As above but all numbers are 3-digit.


SRename "%66%69%6C%65%6E%61%6D%65" MATCH "%/hex/" TO "*chr*"
"%66%69%6C%65%6E%61%6D%65" renamed as "filename"

Converts the byte hex values to their corresponding characters.


To perform numeric conversion tasks MATCH and TO must be used together. MATCH is required to search for and select the numeric data in the filename that will be converted.

Examples:

MATCH "/dec/" TO "*hex*" : Converts every decimal character found to a hexadecimal.


MATCH "+/dec/" TO "*hex*" : Converts every decimal character found that starts with "+" to a hexadecimal. The "+" character is discarded.


MATCH "+/[dec]/" TO "*hex*" : As above but the "+" is retained because only the decimal number was selected by the "[" and "]" selection designators.


MATCH "+/dec/d" TO "%*hex*" : Converts every decimal character that starts with "+" and ends with "d" to hexadecimal numbers with "%" in front of them. The "+" and "d" characters of the decimal numbers are discarded.


MATCH "+/dec/" TO "%*hex*" : The "+" character is discarded and a "%" character is put in front of the resulting hexadecimal numbers.


MATCH "+/[dec]/" TO "%*hex*" : The resulting hexadecimal numbers have both the characters "+%" in front of them.


MATCH "/dec/" TO "%*:hex2*" : Convert the characters of decimal numbers to hexadecimal byte values that start with "%" and are 2-digit.
Note that this is different from using MATCH "/dec/" TO %*hex2*" because in this example a colon is placed before "hex2" and each digit that makes up the decimal number is converted to a hexadecimal byte value and not the entire decimal number as would happen with the latter statement. 

The conversion capability can be handy when you come across filenames that contain hexadecimal values in them like for example:

"12a%3c1%3e.jpg" is "12a<1>.jpg"
"AnnaKournikova%28Karembeu%29.jpg" is "AnnaKournikova(Karembeu).jpg"

To get the real filenames you would simply use:
MATCH "%/hex2/" TO "*chr*"