Advanced features

Here are a few "tricks" and information that may be useful :





The character * (star)

The character (*) can be used in an expression. Placed before the '.' delineating the base name from the extension, it will represent the base name, placed after it will represent the extension.
It is not a variable and its value can not be modified.



Modifiers concatenation

You can "concat" as many modifiers "()" and "[]" as you want. They are evaluated from left to right, the output of the first becoming the input of the second.

Let's examine, step by step, an example on "autoexec.bat" :
%Lb("au","au-")(s/e/e_/g)[2](5).%e

%bonautoexec.batgivesautoexec
("au","au-")onautoexecgivesau-toexec
(s/e/e_/g)onau-toexecgivesau-toe_xe_c
[2]onau-toe_xe_cgivestoe_xe_c
(5)ontoe_xe_cgivesxe_c
the modifier 'L'onxe_cgivesXe_c
add fixed text "."onXe_cgivesXe_c.
add "%e" (extension)onXe_c.givesXe_c.bat


Modifiers precedence

Many different modifiers can be associated to a variable. Here is the order followed for their evaluation :

  1. Special modifier : "{}"
  2. String modifiers : "()" and "[]"
  3. Character conversion
    1. # : '%XX' characters
    2. & : UTF8-ascii to UTF8
    3. @ : Accented characters to standard ASCII
  4. Case modifier


Escape character

You may want to use "special" characters like '(', ';', '*' ... in an expression. To suppress the "special" status of a character, put a '\' (backslash) before it.

For example, to rename the file : Image.jpg to Image(2).jpg with the expression : %b(2).%e
Use : %b\(2).%e



New name path

Except to use absolute paths, new name paths are always relative to Siren's current directory.

Be careful when you are working with the sub-directories loaded (button ).

For example :

Then, after renaming, "paris.jpg" will be in "\" and not in "\photo".
".." is relative to "\photo" and not to "2011".



Environment variables

You can use any variable that is part of the process environment.
Their names have to be specified this way : ${NAME}
For example : ${PATH}

A complete list is available in the "Completion" window.



Include

You can use your favourite expressions like a "library". All written and saved "code" becomes reusable.
The favourite name must be specified this way : #{"exp"}

You can use this only outside of a variable and its modifiers.

For example, if you've got a favourite named "img" associated to the expression "Image %n", you can reuse it these ways :

#{"img"} - Garden.%e
File - #{"img"} - Zoo.%e

It is possible to go a bit further.
The "img" favourite ends with "%n" which is a variable accepting specific parameters. For example : "{2,10}".

If the expression "#{"img"}{2,10} - %f" is applied to "Garden.jpg" :

#{"img"}{2,10} - %fgivesImage %n{2,10} - %f
Image %n{2,10} - %fgivesImage 10 - Garden.jpg

Of course, you can do this with other modifiers.



Sub-expressions

An expression itself can be made up of expressions (or sub-expressions).

By separating them with ';' (semicolon) they can be chained. The "New name" created by one becomes the "current name" in the next.

For example, for "PHOTO CLOWN 1.JPG"

%lf;%b("clown","CLOWN").%egivesphoto CLOWN 1.jpg
%b[3," "].%le;%N{5,10}.%egives00011.jpg


Variables as parameters

In an expression, any parameter can be replaced with a variable and all its modifiers.

This applies to parameters in :

For example, the following expressions are correct :

%f("Text",%At) Will replace, in the name, the text "Text" with the audio title
%f("Text",%uAt(1,5)) Will replace, in the name, the text "Text" with the uppercase first five characters of the audio title
%Rs{%Rn{1,1,10}} Will generate a random string of a random length between one and ten characters

It can be interesting to use this feature with the %T variable.
For example, %T1{%fc} will contain the first line of the treated file.

Note : In certain limits, file lines used with %T are kept in memory by Siren. Therefore the amount of memory used will depend on the number of files treated.