Modifiers

To build a new name you surely want to use a variable but you need to change its value. For example : change its case, delete some characters, switch parts, modify the format of a date ...

Modifiers are the tools that will achieve this.

Different class exists :



Note : In the text below, the string delimiter used is " (quotation mark). In fact, you can use " or ' (apostrophe). The starting and ending delimiters must be the same.



Case modifiers

Case modifiers are specified just after the '%' of the variable :



uall characters upper-case
lall characters lower-case
U first character of each word upper-case, the others lower-case. The words are separated by the characters specified in "Preferences/New name computation/Word separator characters".
Lfirst character upper-case, the rest lower-case

For example, for the file "Ébölie family photo.JPG" :

ExpressionResult
%ufÉBÖLIE FAMILY PHOTO.JPG
%lfébölie family photo.jpg
%UfÉbölie Family Photo.jpg
%LfÉbölie family photo.jpg

In "Preferences/New name computation/Force case" it is possible to define a list of words with a specific case that you want to use. This applies only to variables content therefore not to free text. Two modifiers enable to force or prevent to use this feature directly in the expression :


+force it
-prevent it

If "FamilY" is part of the words with a case to force :

ExpressionResult
%+fÉbölie FamilY photo.JPG
%+ufÉBÖLIE FamilY PHOTO.JPG
%-ufÉBÖLIE FAMILY PHOTO.JPG

Character modifiers (conversion)

These modifiers are represented by a letter following the '%' of the variable :



@ Conversion of accented characters to standard ASCII ('é' → 'e', 'ü' → 'u', 'Á' → 'A' ...)

For example, for the file "Ébölie family photo.JPG" :

ExpressionResult
%@fEbolie family photo.JPG
%@ufEBOLIE FAMILY PHOTO.JPG
%@LfEbolie family photo.jpg

# Conversion of '%XX' characters

You may have noticed that sometimes file names can contain hexadecimal sequences starting with a '%'. They generally appear after a transfert between systems that do not suppport the same character set. This modifier will try to convert these sequences.

Examples :

Content of %f%#f
bb%41cc.txtbbAcc.txt
%C2ccented.txtÂccented.txt
%C3%A9l%C3%A8ve.jpgélève.jpg
%D8%AE%D9%86%D9%81%D8%B3%D8%A7%D8%A1.pngخرحبا.png
%FF%FE%41%00%2E%00%74%00%78%00%74%00A.txt

& Conversion of UTF8-ascii characters to UTF8

You may also have noticed sequences like the ones below. They generally appear because of a wrong interpretation of UTF8 encoded characters. This modifier will try to convert them.

Examples :

Content of %f%&f
élève.jpgélève.jpg
Työpöytä.jpg Työpöytä.jpg
خنفساء.png خرحبا.png


String modifier : "[ ]"

Every variable can be postfixed by a "[]" modifier.

It will be split into an array of substrings following the specified separator characters.
The usage is : [ i, n, "s" ]

i index of the substring to extract
  • If "0" (zero), the complete string is returned without the beginning and ending spaces
  • If negative, the extraction is done from the end
n number of elements to extract starting at the ith one, optional
  • If "0" (zero), the extraction is done until the end of the string
  • If negative, the number of elements to extract is computed from the end of the string
  • 1 is the default value
s list of separator characters, optional
If it is not specified, the list defined in "Preferences/New name computation/Array elements separators" is used

If the chosen string is "%b", "%b[n]" contains the file base name characters between the n-1 and nth separator occurrences. Beginning and ending spaces are deleted (full trim).

For example, on the file :
"01 - Artist_Group - Song title .mp3"
with "-" in "Preferences/New name computation/Array elements separators" :

ExpressionResult
%b[3].%eSong title.mp3
%ub[3] - %b[2].%eSONG TITLE - Artist_Group.mp3
%b[1,2].%e01 - Artist_Group.mp3
%b[1].%e01.mp3
%b[-3].%e01.mp3
%b[-1].%eSong title.mp3
%b[0]01 - Artist_Group - Song title
%b[2,"_"]Group - Song title
%b[2][2,"_"]Group
%b[2,0].%eArtist_Group - Song title.mp3
%b[1,-1].%e01 - Artist_Group.mp3
%b[2,2,"t"]ist_Group - Song


String modifier : "( )"

Every variable can be postfixed by a "()" modifier.

This modifier can have several functions :






Date modifier

In Siren, the default date/time format is YYYYMMDD_HHMMSS.

By postfixing a "date" variable with a "{}" modifier (opening and closing braces) it is possible to specify the format to use and change its value. For more details about its syntax, consult the dedicated help page.

The usage is : { "f", t }



Modifiers specific to some variables

It is possible to modify the presentation and the value of some specific variables :

Here is the a list of these variables with the description of their dedicated modifier.


For the selection numbers : %n, %np, %nc, %ncs, %ncf and %ncfs
the usage is : { p, s, i }


For the numbers contained in the base file name : %N, %N1, %N2 ...
the usage is : { p, v, n }


For the non numeric strings contained in the base file name : %NN, %NN1, %NN2 ...
the usage is : { n }

For the number of selected files : %ns and for the track numbers: %mT, %AT and %An
the usage is : { p }

For the length of random strings : %Rn, %Ra and %Rs
the usage is : { l }


For example (if the default values have not been modified) :

ExpressionSel Num 1Sel Num 2Sel Num 3
Img_%n{2}.jpgImg_01.jpgImg_02.jpgImg_03.jpg
Img_%n{2,10}.jpgImg_10.jpgImg_11.jpgImg_12.jpg
Img_%n{2,10,5}.jpgImg_10.jpgImg_15.jpgImg_20.jpg

For Fic2_15zzz784.txt :

%N{4,0,1}gives0002
%N{4,0,-1}gives0784
%NN{-1}giveszzz


Group renaming

By default a variable content always belongs to the file currently treated. This modifier allows to change this behaviour and use the information from another file of the "group" it belongs to.
A group is a number of consecutively selected files.

This modifier must be specified immediately after the '%'.

The usage is : < p, i >

It only applies to the variable it is associated to.

Here are a few examples based on files named : aaa.doc, aaa1.pdf, dcmt.doc, dcmt-two.pdf and selected following the same order :

Expressionaaa.docaaa1.pdfdcmt.docdcmt-two.pdf
%<2,1>b.%eaaa.docaaa.pdfdcmt.docdcmt.pdf
%<2,2>b.%eaaa1.docaaa1.pdfdcmt-two.docdcmt-two.pdf
%<2,1>ub(1,2).%ueAA.DOCAA.PDFDC.DOCDC.PDF
%b.%<2,1>eaaa.docaaa1.docdcmt.docdcmt-two.doc
%<2,1>b-%<4,4>b[2].%eaaa-two.pdfaaa-two.pdfdcmt-two.pdfdcmt-two.pdf

A detailed example can be found here

.