Siren 3.00 beta 2 build 888

It seems the new regex engine doesn't support the \U and such flags?

I mean those as shown with "Extended with improved  RegEx" at http://scarabee-software.net/forum/view … d=337#p337


Test file:  sumCOINS.awk.bak.txt

Expression: %b(s/\.(\w)/.\U\1/).*
(Just to upper case the letter behind the first dot. Simple test)

Result v2:  sumCOINS.Awk.bak.txt

Result v3:  sumCOINS.Uawk.bak.txt

77

(11 replies, posted in Evolution requests)

Rémi wrote:

Let's say its name is "C:\sr_n2a.txt"
For test purpose I've created mine. I can send it you if needed.

If i may...
Copy this code to an plain text file with VBS extension and execute it to get such an sr_n2a.txt file:
(Note: this is Windows platforms only i think. But now i have an reason to start with python ;-) )

SirenCharListCreator.VBS

'SirenCharListCreator.VBS
' Create char list "sr_n2a.txt" visual basic script
' '''''''''''''''''''''''''''''''''''''''''''''''''
' 97  = a
' 98  = b
' 99  = c
' ... = ...
' 122 = z
' For upper case chars A-Z use numbers 65-90 ( google for ASCII table to see why)
' '''''''''''''''''''''''''''''''''''''''''''''''''


'CODE:
' This 97-122 are 26*26=676 possibilities wit two chars aa-zz. 
' uncomment the two "X" lines to get even 26*26*26=17576 with three chars aaa-zzz

'For x = 97 to 122
    If x Then iteration = chr(x)

    For i = 97 to 122
        iter = chr(i)
        For c = 97 to 122
            OUT = OUT & iteration & iter & chr(c) & vbCRLF
        Next 'c
    Next 'i

'Next 'x
' '''''''''''''''''''''''''''''''''''''''''''''''''


'OUTPUT:
ForWriting = 2
Set FSO = CreateObject("Scripting.FileSystemObject")
Set outfile = FSO.OpenTextFile("sr_n2a.txt", ForWriting, True)
outfile.WriteLine(OUT)
outfile.Close
MsgBox "Done. See sr_n2a.txt in same folder."

'<EOF>



To create list with roman numbers use:

'SirenRomanNumbersListCreator.VBS


'CODE:

FOR i = 1 to 145
   OUT = OUT & Decimal2Roman(i) & vbCRLF
NEXT


Function Decimal2Roman( ByVal intDecimal )
   ' COPY HERE THE        Function Decimal2Roman( ByVal intDecimal )
   ' FOUND AT             http://www.robvanderwoude.com/vbstech_data_roman.php
End Function
' '''''''''''''''''''''''''''''''''''''''''''''''''


'OUTPUT:
ForWriting = 2
Set FSO = CreateObject("Scripting.FileSystemObject")
Set outfile = FSO.OpenTextFile("sr_Roman.txt", ForWriting, True)
outfile.WriteLine(OUT)
outfile.Close
MsgBox "Done. See sr_Roman.txt in same folder."

'<EOF>

Note: this is Windows platforms only i think.
But now i have an reason to start with python ;-)

>>> for i in range(97,122):
...   for x in range(97,122):
...     print(chr(i),chr(x))
...
a a
a b
a c
a d
a e
a f
a g

78

(4 replies, posted in How to ...)

Q:  How can i change the leading numbers, e.g.:

      FROM:
      1 - file 1.txt
      2 - file 36.txt
     
      TO:
      16 - file 1.txt
      17 - file 36.txt

 
 
   
A: First idea is to do this in two steps:
     1.) remove leading numbers
     2.) add new numbers starting at '16'
   
   
   
How-to:

    - Select all files in Siren
        ( take care to have the files in the wanted order,
          AND to select them top-down one-by-one, or all the same time,
          because the %n parameter takes the selection order into account)

    - Type this into the Expression field:
       %f(s/^\d+//);%n{1,16,1}%f

   - execute menu "Action > Recompute" for an preview
   

   
   
Explanation:

    This are two expression, separated by an semicolon
    %f(s/^\d+//)
    ;
    %n{1,16,1}%f
   
       
    The first expression is an regex search and replace
    which search for leading digits and replace them with nothing, meaning: remove them.
   
    The second adds an counter "%n" in the order the files are selected.
        (if you don't see the right sequence 16,17,18,... un-select and select again)
    The parameter  {1,16,1} is an modifier and stands for {padding width, start at, step width}
    Then the rest of the original (new computed from the first expression) file name is added by the %f variable.
   

   


- - -



  But with Siren you can do it more then one way:



Q:  How can i change the leading numbers, e.g.:

      FROM:
      1 - file 1.txt
      2 - file 36.txt
     
      TO:
      16 - file 1.txt
      17 - file 36.txt


A: You could use the "%N" (upper case N !!!) variable:

      %N   : a number contained in the base file name
               A digit can indicate its position (1 by default)


      The parameters of some "number" variables can be defined in "Options" ("Numbers" sub-menu).
          They can be specified too directly in the expression inside a "{}" modifier (braces)
           that postfixes the variable name.

      For the numbers contained in the base file name: %N, %N1, %Nn ...
          the usage is: "{ p, v, n }"
                p : size / pad (length of the number, padded with zeros if needed)
                v : value to add (positive or negative)
                n : position of the number to extract. If negative, the extraction is done from the end.
       
   
How-to:

      - Select all files in Siren

      - Type this into the Expression field:

       %N


      - execute menu "Action > Recompute" for an preview
     
     You will get:
     001
     002

     (the number is padded with two zero as defined in "Options"  IF your Siren settings is still the default)
     
     
     
     OK, that have to be improved, and we have to see how to get the rest of the file name.
     
     
     First, we do the adjustment of this numbers:
     
     -  modify the expression to %N{2}

     You will get:
     01
     02

    (do you remember the modifier "{ p, v, n }"  for the number variable?
      or more clearly: "{ padding width, value for calculation, pos of number to extract from the name }")


     
     
     
    Since we wanted to add '15' to the leading numbers to get '16'

     -  modify the expression to %N{2,15}

     You will get:
     16
     17


    Done!  big_smile

     
     
     
   What please?    neutral
   Ohh, you want the remaining part of the name too?  OK:  tongue





   To get the rest of the file name you can

     -  modify the expression to %N{2,15}%f

     You will get:
     161 - file 1.txt
     172 - file 36.txt

     The "%f" variable will get you the whole file name incl. the extension.
     
     But since we do not need the first sign here (the digits '1' and '2') we can
     add an modifier to the '%f' variable too to get the file name from the second sign to the end:
     (Check the help for   String modifier : "( )"  to see how this works)


     -  modify the expression to %N{2,15}%f(2)

     You will get:

     16 - file 1.txt
     17 - file 36.txt


     Pretty fine!  Done?   big_smile
   
     
     
     
    Yes, mostly. But what if i had file names like:

     1 - file 1.txt
     2 - file 36.txt
     21 - file 4.txt
     32 - file 6.txt



    And with an expression like %N{2,15}%f

    you will get:

     161 - file 1.txt
     172 - file 36.txt
     3621 - file 4.txt
     4732 - file 6.txt

    Here i had to remove one time 1, and the other time 2 signs from the beginning?
    I had to use %f(2) and then %f(3) depending on the amount of leading digits????
    How can i do this????



   Well, here i would use an other modifier for the "%f" variable:

     -  modify the expression to %N{2,15}%f[2]

     You will get:

     16file 1.txt
     17file 36.txt
     36file 4.txt
     47file 6.txt

     (IF your Siren settings is still the default and "-" is still the default "Array elements separators" in the options.
          Check the help for   String modifier : "[ ]"  to learn how this works)
          In short: that %f[2] will split your file name at the   "-" delimiter,  as set in the options,
                        and the '2' will get use the second part of the split-ed name.




     Now just add the missing "space dash space":

     -  modify the expression to %N{2,15} - %f[2]

     to get the wanted:
     
     16 - file 1.txt
     17 - file 36.txt
     36 - file 4.txt
     47 - file 6.txt




      Done!  big_smile



      ? please ?   hmm

      Ok, Ok, i understand: what if you want to do the math on the second number from the file name?  smile


      To modify the second number found in the name, you can change the expression

      to %N{2,15,2}
      or
      to %N2{2,15}

     to get:

      16
      51
      19
      21



      And to get the rest of the file name you can maybe use an regular expression
      since the length of the name is different from file to file:

      Expression:  %b(s/(.+ )\d+/\1/)%N2{1,15}.*
      (From the base name, match all till trailing digits, then drop those digits in the replacement)


     What? You don't speak RegEx? That looks crazy as hell?
     Nema problema!  cool

     Just use the power of Siren to do this for you and use the "%NN" variable.

      See help Variables > Base > %NN
                             %NN, the "opposite" of %N : a non numeric string contained in the base file name
                                                                            A digit can indicate its position (1 by default)




     With that knowledge we can use this crude looking expression

     %N%NN%N2.*

      to get:

      001 - file 001.txt
      002 - file 036.txt
      021 - file 004.txt
      032 - file 006.txt
     
     
            %N     will hold the first number in the name
            %NN   the first non-digit part of the name
            %N2   the second number in the name
            .*       just adds the original extension.
     
     
      and that combined with the above explained number-variable modifiers

      %N{1}%NN%N2{2,15}.*

      you get the wanted:

      1 - file 16.txt
      2 - file 51.txt
      21 - file 19.txt
      32 - file 21.txt

      or even change the first %N{1} to %N{2}

      to get:

      01 - file 16.txt
      02 - file 51.txt
      21 - file 19.txt
      32 - file 21.txt

      ---------------------------
      To show the possibilities, here an more complex example.
      Again, modify the second number from the file name:

      FROM:
      1 - file 1 test1.txt
      2 - file 36 check2.txt
      21 - file 4 look3.txt
      32 - file 6 adjust4.txt

      Expression:
      %N{1}%NN%N2{2,15}%NN2%N3{1}.*

      TO GET:
      1 - file 16 test1.txt
      2 - file 51 check2.txt
      21 - file 19 look3.txt
      32 - file 21 adjust4.txt

      Explanation:
      %N to get the first number "32"
      %NN to get the first non-number part " - file "
      %N2 to get the second number "6" which get calculated by {2,15} to "21"
      %NN2 to get the second non-number " adjust"
      %N3 to get the thirs number "4"

      With other renamers you would have to build an regex like:
      %b(s/(.+ )\d+(.+)/\1/)%N2{2,15}%b(s/(.+)\d+(.+)/\2/).*
      Compared to that the syntax of Siren is more then simple and user friendly.
      ---------------------------
     
     
      Done?  roll
      Yes?  big_smile
      Phuu!  smile
      OK, your welcome!  cool

      Depending on your file name the way to your solution may differ from this examples.
      But in the help you will find all possible variables to solve your  challenge.
      Often you just have to think about from an different point of view ;-)
      And in the end you can always ask an question at the  forum (but please take an clever
      description for the subject line and provide real examples of your file name, thanks.)





Find me: Renumbering Re-Numbering Exchange Numbers Serialize
Serializing Digits do the math reckoning calculation computation counting
     
.

I missed an column with the path length and one with the name length.

[Current Name] [New Name] [Path Len] [Name Len] [Sel]


I wanted to check the complete length of path/file name.ext after computing an new name.



I found an work around:

Use Expression: %f, %pa or %fa

Since "Manual Rename" dialog (F2) doesn't support the Ctrl+Shift+E option
   (ohh, it contains the name part only anyway. But shouldn't  CS+E works here too?.
      OK, since this is an extra dialog it would be tricky to get it to work i guess.)

i have to use the "Insert pointed value into expression" context menu option.

Then i can select the expression field and  press Ctrl+Shift+E and see the actual path/file length in the status bar.

S> Since "%Rn{n}" can result to zero too, the computed file name is often "nothing"

R> Replace 0 with 1 :
R> %b(1,%Rn{1}(s/^0$/1/)).*

Hey, that really works ;-)
Good solution. I have found my way too, see last paragraph.

--------------------------------------------------------

R> you should use : %T1{%fc}

Upps, you are right of course.

--------------------------------------------------------

R> I've decided to max out the length to 50
R> I can easily change these in the next build if needed.

Good to know. I think greater values are not really needed.
We can also use that variable more then once. %Rs{50}%Rs{50}%Rs{50}%Rs{50}
But since i use explicitly the {n} modifier i should get what i want and the limit should be 255.
But I can live with the current behaviour.

--------------------------------------------------------

R> I imagine you meant "%Rn{n,m}". This feature would only be meaningful for numbers.

Oh yes, since it is used now with the substr() feature only, only digits are meaningful.
(I had thought above about my first silly idea to have that min/max for all  that  %Rx   separately)
It is ok. I only want to know.

I found an way to get this min/max length i was after:
To be sure to have 4 signs at least i use
%Rs(1,4)%Rs{9}(1,%Rn{1}).%lRa{3}

I can live with this current behaviour too.

At least for the moment. Lets see what further test will discover smile

--------------------------------------------------------

R> typo

Always the same roll

Siren 3.00 alpha 2 build 805
+ Variables can be used as a expression parameters
   For example :
               %b("title",%At).%e
               %b("title",%Rs{10}(1,%Rn{1})).%e
               %T{%fc}

Thank you, just on testing  on Windows XP SP3 (without renaming, expression field only right now).

--------------------------------------------------------

Example 1:

%T{%f}(%Rn{1}).*


Since "%Rn{n}" can result to zero too, the computed file name is often "nothing"

I am not saying getting an '0' is bad at all. Maybe sometime that's exactly what we need.
I just mention it here for reverence.

--------------------------------------------------------

Hmm, i am sure "%T{%fc}" worked on more then one file an minute ago,
but now only the first selected file get computed and shows the first line from that file.
If i deselect that first file, the second selected file get now computed.

--------------------------------------------------------

Example 2:

%b("Spongebob",%Rs{10}(1,%Rn{2})).%e

works fine.

--------------------------------------------------------

Max value for
%Rs{n}
and
%Rn{n}
seems to be '50'

Values greater then 50 fall back to default '8'

I have not really counted the amount of signs, but you see it if you use %Rn{50} and %Rn{51}.

--------------------------------------------------------

Example 3

%Rs{25}(1,%Rn{2}).%lRa{3}

gives nice random file name from random length.

aNGETd1zDtR8GCLdYgZ2STy3u.lhw
al.lak
bYBHOIsXIBoy5RwQbSj.wpw


--------------------------------------------------------

Question: The "%Rs{n,m}" syntax was to much to implement?

--------------------------------------------------------

Or an other idea, if one don't want to create new folders at all,
we can "ban" the slash and the backslash from use
under "File > Preferences > Modifications > Chars to delete\replace" automatically.

Rémi wrote:

I'm not sure to understand what you mean with %Ra{3,4}.

I was thinking on the regex matching parameter .{min,max}
Like that matching minimum min and maximum max signs,
%Ra{min,max} would randomly give back min to max signs.

Just to have even more randomness.

%Rn{2,4}
would give something like
123
34
5678
654
43
345



But this logic would maybe better fit to an extra "String extraction substr : ( p, n ) "
with variable parameters for an general use, not only for %R.

But only if you see the use and the time to code this. This was only something i missed from my tests.

Just as an idea.


While testing %Rn

i am wondering how to generate random string/filename length?

For example:
%Ra{3,4} to get minimum three and maximum four  chars?



Or more general something like:
%b( 1,  %Rn{2} ).%e
or
%Rs{99}( 1,  %Rn{2} ).%e

Q: Before secure deleting my files and overwriting with zeros,... how can i randomize the file names first?


A: That is easy to do with Siren renamer:


Download and unpack the new beta of version 3 of Siren, now for both Windows Win32 and GNU/Linux,
from http://scarabee-software.net/forum/viewtopic.php?id=273  (or newer)


There you have the new expression elements:

Random number (%Rn),
alpha (%Ra)
and string (%Rs).

They all can be followed by "{<length>}"

(With Siren renamer v2 you have %R only (a four digits pseudo random number) )


So use as
EXPRESSION: %Rn

to get eight digits like
26910045
63646763
91475005



Or EXPRESSION: %Ra
to get eight upper or lower case chars like
ZwAPQRvL
wigrOvjc
DZXxpHqL



Or EXPRESSION: %Rs
to get eight upper or lower case chars or digits like
gcVQq7sZ
e2nsaw4E
e2fgWq21


Use EXPRESSION: %Rs.%Ra{3}
to get eight sign, an dot, followed by three chars like:
hxSPRW0M.ozI
8AWyfdiF.IHw
sAfmWR9Y.WCv


You can use the default parameters like u,U,l and L to change the case
to get always lower case "extensions": %Rs.%lRa{3}
RRxJ7Gc2.fkb
MY20H08X.mmk
at2jVEr6.qby


And then you can use this {...} length and the case modifier to the "name part" too: %uRs{12}.%lRa{3}
DYXSVVR0WSSM.jue
MHZ26YJKS8TA.aoj
GNAKYOO9TJXQ.jzu


Examples:

Maybe you want to add an randomized number in front of your MP3 files to make an random playlist?
%Rn{3} - %f

-

You can also combine this elements like e.g.: %Ra%Rn{2}
MxtYVOxh18
xopVYBjZ61
hzUbDntO60
to generate passwords ;-)

-

To add four random lower case  chars at  the end of the original file name, right before the dot of the
extension, (maybe before joining differend sub-folders to not overwrite same file names) use: %b %lRa{4}.*




Press the F1-key while you are in Siren to read more about.
Enjoy Siren,  No installation needed, unzip and run. Siren stores it settings into an ini file, not in the Registry.
------------------------------------------------------------------------------------------------------------

                                             Siren is a freeware file renaming program
                                               - portable, highly flexible, powerfully -
                                          If it's looking tricky it's easy to rename with Siren.
                                          http://www.scarabee-software.net/en/siren.html

                                          Now for Windows Win32 and GNU/Linux also:
                                          http://scarabee-software.net/forum/viewtopic.php?id=273

Test with Siren_300_alpha1_build_784_windows.zip, both real text files on disc and with testbed (menu "? > Expression testbed"). Undo works well too.


Q: I want to replace an hyphen/dash/minus "-" by an plus sign "+". But only the second one!

  FROM:
     SpongeBob, Schwammkopf, S01E17 - Die Schatzsuche - Bus verpasst.ext
     SpongeBob, Schwammkopf, S01E18 - Texas - Energisch.ext
     SpongeBob, Schwammkopf, S01E19 - Aprilscherze - Ein göttlicher Burger.ext
  TO:
     SpongeBob, Schwammkopf, S01E17 - Die Schatzsuche + Bus verpasst.ext
     SpongeBob, Schwammkopf, S01E18 - Texas + Energisch.ext
     SpongeBob, Schwammkopf, S01E19 - Aprilscherze + Ein göttlicher Burger.ext


A:  That's looking difficult but can be done easy with Siren

         To read what we do now press F1 in Siren
         and go to "Expression > Modifiers > String modification : "( )" "
         and there a little bit down to
           
           String replacement
                      The usage is near of the standard "replace" : ( "s1", "s2", s, n, c )
                      s1     string to replace
                      s2     replacement string (If it is not specified, the string to replace is deleted)
                      s       starting occurrence (If negative, it is relative to the end of the string)
                      n       number of replacements to do (If negative, all remaining occurrences are treated)
                      c       number indicating if the search is case sensitive : 0 (zero) for no, any other value for yes


To make it easy we use the Siren variable %f which will work on the whole file name incl. the extension.
(To work on the base name only use %b and %e for the extension. But you may need this only to replace all dots but the last.)

So use the
EXPRESSION: %f

and press the Enter-key so the NewName is computed.
You will see the same as in the CurrentName column because %f just is an placeholder for the filename incl. extension.
No modification is done right now.

--

Now we utilize  the "String replacement" modifier ( "s1", "s2", s, n, c )  to the %f parameter.
First we start simple and just do the basics: %f("find string", "replacement string")

Or in our case:
EXPRESSION: %f("-", "+")

and press the Enter-key so the NewName is computed.

You will see as NewName something like:
SpongeBob, Schwammkopf, S01E17 + Die Schatzsuche + Bus verpasst.ext

As you may have noticed this has replaced all both hyphens "-" in that name to an plus sign "+"

--

So let use use now one of the advanced parameters ",s ,n ,c" of this expression element :

EXPRESSION: %f("-", "+", 2)

and press the Enter-key so the NewName is computed.

You will see as NewName something like:
SpongeBob, Schwammkopf, S01E17 - Die Schatzsuche + Bus verpasst.ext
where only the second (, 2) hyphen "-" is replaced by an plus sign "+".

Done. Problem solved!

All till now was testing only.
If you are satisfied with this result press the Rename button to do the actual renaming itself.


- - -



More examples?
OK, here we go....



And how would you remove just the first coma?

To get:
SpongeBob Schwammkopf, S01E17 - Die Schatzsuche - Bus verpasst.ext

use EXPRESSION: %f(",","",1,1)
or just %f(",", ,1,1)

which means: find an coma and replace with nothing, or in other words: remove it.
Then the first "1" means start at FIRST occurrence of coma found,
and the second "1" means: work on ONE occurrence only, then stop the work.



You can make an another test run with %f(",", ,2,1)


- - -



And how do both replacements (hyphen and coma) at the same time?

Easy, just use the command separator ";" between both expressions:
%f("-","+",2);%f(",",,1,1)

Note that you can also use more then one "String replacement" modifier on one expression like:
%f("-","+",2)(",",,1,1)



---

Related topics:
Replace the '.' (dots) with ' ' (spaces)
... entferne Punkte aus dem Dateinamen






Press the F1-key while you are in Siren to read more about.
Enjoy Siren,  No installation needed, unzip and run. Siren stores it settings into an ini file, not in the Registry.
------------------------------------------------------------------------------------------------------------

                                             Siren is a freeware file renaming program
                                               - portable, highly flexible, powerfully -
                                          If it's looking tricky it's easy to rename with Siren.
                                          http://www.scarabee-software.net/en/siren.html

                                          Now for Windows Win32 and GNU/Linux also:
                                          http://scarabee-software.net/forum/viewtopic.php?id=273

Rémi wrote:

Hello,

The first version of the "Expression testbed" has been added in the last build (784).
I hope it corresponds to what you expected.

Remi

+ Add Expression testbed (Menu "?")


100% hit. Looks very good. Thank you.

How to use:
- go to menu '?'
- choose "Expression testbed"
- write a few file names (or copy some from the forum)
- add the wanted expression (try  "%ub(1,3)%b(4).*")  and press Enter-key
   You can press the little tag icon on the right for an complete list of possible expression variables.
   Note: since this are not real files but strings only, there will be no real output from that variables providing 
   file properties or meta-tags normally. If you see any, then that are taken from the running Siren.exe instead.
- watch in the lower pane how your entered expression has impact on the strings from the upper pane.

This new feature is very useful just to find an matching regular expression or to to experiment with the case changing
variable or the string manipulation modifiers  without the need to create  real files first.

Ideal for forum regulars to help them supporting user questions and for user to play around without fear to mess up there files big_smile

Saluté

R> But you know that there will a lot of limitations

Yes, mostly i anyway didn't have the real files, all i have are the example strings from the forum
from which i create dummy TXT files with currently needed names. So i guess that would be the same.

Works with Siren 3.0 too.


0000%b(s/.+\((\d+).+/\1/).%e;%b(s/img_.+/0/)(-3).%e

or
0000%b(s/.+\((\d+).+/\1/).%e;%f(s/img_.+/0/)(-7)

or
00000%b[2,")("].%e;%b(-3).%e

gives:
000.jpg
001.jpg
010.jpg
002.jpg



Explanation:

00000 ==> add padding zeros
%b ====> work on the base name
[2,")("] => return substring No. 2, use ")" and "(" as delimiter (the order of the delimiter doesn't matter)
.%e ===> add dot and original extension

Gives me:
00000.jpg
000001.jpg
0000010.jpg
000002.jpg


; =====> Siren delimiter for second expression

%b(-3).%e  ==> give me the last three signs from the right of the base name, then dot and extension

Gives:
gives:
000.jpg
001.jpg
010.jpg
002.jpg

90

(3 replies, posted in How to ...)

Works with Siren 3.0 too.


Only since the regular expression engine has changed to wxwidgets
we have to use the \n syntax instead of $n for backreferencing:



Instead $1, $2, $3,...

EXPRESSION:    %f(s/(\d+)\s*-*\s*(.+)/$2/)
---------------------------------------^


use \1, \2, \3,...

EXPRESSION:    %f(s/(\d+)\s*-*\s*(.+)/\2/)
----------------------------------------^



You can find details about the regular expression syntax in the wxWidgets online documentation
(http://docs.wxwidgets.org/trunk/overview_resyntax.html).
(Siren uses the ARE flavour)

I guess there is an reason there is no "Evolution requests" sub forum ? ;-)

But i need this option often. Maybe it's from interest to you?


For own testing issues or for helping questions on the forum
i find it not comfortable to always create new temporary files.

So if it is not to much:
can you add an kind of window
where we can write or paste a few lines of file names
and where the settings from the expression field can be applied?

Something like:

------------------------------------------
Expression: [ %ub.%e                ]
------------------------------------------
File name.ext
Pasted file names.ext



------------------------------------------
FILE NAME.ext
PASTED FILE NAMES.ext



------------------------------------------>>




This has nothing to do with freeform modifying the real file names, just working on text only.
There is no way back to the future name column. This is only to test expressions with strings.

Siren renamer has no scripting support build-in.

But he has something even better:
use your favorite text editor (or even Word with VBA)
where you are familiar with scripting for your advanced modification needs!


Here is an quick how to for you:


1.) launch Siren with the files you want to rename (Or open Siren and browse for an folder)



2a.) use "Edit > Copy the selection > Current names" to copy the whole file name to the clipboard
       or,
2b.) if you want to just edit the "base name" without the extension, do this simple steps:
       -- in the Expression field write  %b  *1
       -- now you get as Future name the file name without the extension
       -- click the column header with right mouse button and choose "Copy selected files data" to the clipboard

            *1 ( or "%p_%f"            for   ParentFolder_FileName,
                   or "%pa_%b_%e"  for   FullPath_FileName_Extension,
                   or..., or..., or....,      just  right click the expression field ;-)   )


3a.) use an text editor with scripting support (e.g. PSPad, Boxer, EmEditor, (HippoEDIT), UltraEdit)
       or Word and his VBA scripting, and use that scripting feature to modify your names,
       or use simple rectangular selecting, or zero-width selecting to change parts of your file.
       Or save the exported file names to an temp file and let an script (e.g. VBScript, JScript, AutoHotkey, AutoIt)
       or command line tool like SED (i),AWK (i) or SFK (i) run against it.
       Warning: don't add or remove lines, or your files get messed up if you confirm the preview!



4.) Once you are finished, copy the modified names to the clipboard again.



5.) back in Siren use the expression %C to insert the clipboard line-by-line
       Use %C.%e to add an dot and with %e the original extension of the file.




Now watch the preview in the Future name column, and if all went fine do the renaming.

Here is an picture how this could look:

http://forentmp.lima-city.de/Siren_Scripts.png

placeholder, later more...


HTH?  big_smile

Siren 3.00 alpha 1 ( read more at >> http://scarabee-software.net/forum/view … hp?id=273)


Quick downloaded and first test:

- starts good on Win XP SP3, did just an lookaround, no renaming till now
- looks like the old one (Siren 2), fine.


- "Environment variables supported" is helpful. The expanded examples in the 'Completion Window' are nifty.
(maybe this can be done too for other variables like the one on the 'Base' and 'Date' tab?)

- i noticed the 'Completion Window' button, helpful.

- Hey, there is an wizard!  Just playing around with it.

- "A favourite expression can be "included" in an expression:" ,  Fine, i can see an use for this.

- to be continue...


EDIT:  if you need more tester i can post the beta release on an freeware forum?

FROM:
Renamer_Siren.jpg
Renamer_Siren_Utility.jpg
Renamer_Siren_Utility_2002-2010.jpg

TO:
Siren_Renamer.jpg
Siren_Renamer_Utility.jpg
Siren_Renamer_Utility_2002-2010.jpg.

DO Expression:
%b(s/([^_]+)_([^_]+)(.*)/\2_\1\3/).%e


Explanation:

%b(    s/    ([^_]+)_([^_]+)(.*)    /    \2_\1\3    /   )   .%e


%b  ====> work on the base name without the extension

( s/ / / ) => do an regular expression search and replace => ( s/match/replace/mod)

.%e ====> add the original extension

([^_]+)_  ==> find one-or-more sign which are not an underscore, till an underscore is found ===> "Renamer" + "_", store all match inside (..) in group 1

([^_]+) ====> again the same but till the end (or till an underscore is matched by next expression) ===> "Siren", store in group 2

(.*) =======> maybe match none-or-more of any sign ==> <none> or "_Utility" or "_Utility_2002-2010" , store in group 3

Replace with what is matched in group 2, add an underscore your own, then the content of group 1, then 3 if any ==> \2_\1\3

.

FROM:
img_20080423095549.jpg
img_20080423095549(1).jpg
img_20080423095549(10).jpg
img_20080423095549(2).jpg

TO:
000.jpg
001.jpg
010.jpg
002.jpg

USE:
0000%b(s/.+\((\d+).+/\1/);%b(s/img_.+/0/)(-3)


EXPLANATION:
0000 -----------------------> Add a few padding zeros, no matter how much but as many as the shortest string needs.
%b(s/.+\((\d+).+/\1/)--> extract digits between (...)
; ---------------------------> separate different actions
%b(s/img_.+/0/) --------> rename file without (...) to 0
(-3) ------------------------> keep the last three signs from string only.


0000(-3) is used to pad numbers with different length (1 or 10 or 100) to the same end length (001 and 010 and 100)
First i add a many 0's so all strings have at least the length they should have, then i take the amount of signs i really want from the right.

.

96

(0 replies, posted in How to ...)

XYplorer is an fine file manager >> www.XYplorer.com

although XYplorer have an good till advanced renamer tool, it lacks an more advanced one,
here comes Siren renamer to work big_smile


http://www.scarabee-software.net/en/siren.html
Just download and unpack the Siren_201.zip (400kB) into your XYplorer folder:
One EXE   1MB (350kB UPX)
One INI (after first launch)


Some examples how to use Siren from XYplorer:

      ::run """<xypath>\Siren.exe"" <curpath>";   //current folder name itself

      ::run """<xypath>\Siren.exe"" <curpath>\";   //show all files inside current folder

      ::run """<xypath>\Siren.exe"" <selitems>";  //rename the items currently selected

      ::run """<xypath>\Siren.exe"" /F *.<curext>"; //all files from same type as the currently selected file type


Execute Siren with an rename expression,.. rename and end:

      Siren command line usage: escape the quotes by an leading \
                                                             /E %b(\"_\",\" \").%e

      XYplorer usage: escape the quotes by doubling them
      ::run """<xypath>\Siren.exe"" <selitems> /E ""%b(\""_\"",\"" \"").%e"" /P";

Advice:  - For a complicated expression, use a favorite ("/A") rather than an expression ("/E") like above.




Some examples what can be done with Siren renamer by Scarabée Software:
    (Note:
              there are no check boxes or many input fields, just an field to enter an expression.
              Read the help and try an right click into this expression bar.)


      %f   : the file name
      %b   : the "base" name
      %e   : the name extension


Every variable can be postfixed by a "[]" modifier.  It will be split into an array of substrings.
  The usage is: "[ array-element no. n, "separator" ]"
  Example: for "Artist - Title.mp3" the expression "%b[2] - %b[1].%e" will exchange Artist and Title.

Every variable can be postfixed by a "()" modifier for - Substring extraction
  The usage is: "(start pos, amount of chars)"
  Example: for "The Artist - Title.mp3" the expression "%b(5).%e" will crop the first four signs.
  Example: for "random string, fixed string.ext" the expression "%b(-12).%e" will only keep the last 12 signs.
  Example: for "Sales, random string, 2010.ext" the expression "%b(1,5) %b(-4).%e" will crop the random string in the mid.

Every variable can be postfixed by a "()" modifier for - String replacement
  The usage is: "("find me", "replacement", starting occurrence, number of occurrences to proceed, case sensitive)"
  Example: for "The Artist feat singer - Title stinking feat.mp3" the expression "%b("feat", "feet", 2).%e" will replace the second 'feat' to 'feet' only.

Every variable can be postfixed by a "()" modifier for - Modification by regular expression
  The usage is: "(s/ match regexp / replacement fmt / modifier)"
  Example: for "Document 09-2010.ext" the expression "%b(s/(\d\d)-(\d\d\d\d)/\2-\1/).%e" will exchange '09-2010' to '2010-09'

Read more examples and about the other dozens features in the help of Siren renamer wink
See how Siren looks: http://www.scarabee-software.net/image/ … _en_02.jpg


Description of Siren at PortableFreeware.com:
http://www.portablefreeware.com/?id=1315
  Synopsis: Siren is a file renamer which allows for batch file renaming based on expressions
      (kind of an extended Regular     Expression syntax). Also allows for insertion of file information (file Date, ID3 tags).
  Writes settings to: Application folder in an INI file
  How to extract: Download the ZIP package and extract to a folder of your choice. Launch Siren.exe.
  Unicode support: No
  License: Freeware
  System Requirements: Win98 / WinME / WinNT / Win2K / WinXP / Vista / Win7
  Very flexible and powerful... Does the job perfectly



.

97

(3 replies, posted in How to ...)

Hi fprevos and welcome to the forum.

I am not sure if this is possible, i have to think off ;-) (maby later the evening)

There is already an nice option in Siren to extract an line of text from an given file...
... but not relative to the current file, only absolute to an defined file.

%T   : line extracted from a text file following the file
          selection order.
          a digit can indicate an absolute line number
          The file name is specified between '{' and '}'.
          As the character '\' is an escape character, the ones
          present in the paths have to be doubled.
          Not indicating a file name is equivalent to referencing
          the one previously named. There is no limit to the
          number of files that can be used in an expression.
          Examples:
          %T{"C:\\fr.txt"}
          %T1{"C:\\fr.txt"}_%T2(10,2)
          Fic_%T{"C:\\temp\\fa.txt"} - %T1 - %T{"D:\\fb.txt"}.txt

Your're right, would be nice to have something like %T{"%fa"}
( %fa means actual file with full path)

I will check out later if this is possible, maybe Rémi cames later along too.

Siren 2.0 on Vista (on XP i can test tomorrow)

I have found an problem, i think.
Maybe this work around helps others coming here with such an problem too.


-----------------
In the INI      i have stored as current folder         an path     not existent any more.
And i had set Recursive=1

[courant]
rep=C:\CurrentFolderIsLost
recurse=1
-----------------

Problem:
I start Siren.
Since the folder isn't there any more.... Siren takes C:\ as current folder.
Since i have set recurse=1....... Siren starts to load ALL sub-folders  of C:\

I tried to press ESC to cancel this process, but this do not solve this issue.

-----------------
Solution:
Close Siren by pressing on the [X]-button  (maybe this need an second press on X)
Open the Siren.ini
Change "recurse=1"  unter  "[courant]"  to "recurse=0"
Save the Siren.ini
Start Siren again
-----------------

99

(1 replies, posted in How to ...)

At least thank you for sharing ;-)

100

(16 replies, posted in How to ...)

Ah, @ Rémi:
the boost links in the help like http://boost.org/libs/regex/doc
are not longer valid, just FYI