101

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

Hi, i can't follow you right now. To early in the morning. But...
...here are some thought, don't know if this help you or if that works in Siren.


> I havning problems filtering only the ones I need to rename.
Siren have an Filter to show only matching files. Maybe this helps?
From the help "In the "Filter" combo, you can enter a string to limit the file  list (for example: *.mp3)."


> If that 5th character (from the right) is a number 1-9, then grab 4 digits from the the right .... Is this possible with RegEx?
Siren use the RegEx engine of boost which should provide "Lookaround"
I have no time, but you could search for "positive, negative, lookbehind, or lookahaed"
or here is an link http://www.regular-expressions.info/lookaround.html
Something like: (?<=\d)\d\d\d\d

.

102

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

Good luck!

And come back and tell us the whole solution story for sure ;-)




Thanks for your feedback!

103

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

Maybe
Expression:  %fa#delim#c:\Projects\\%b(5)\\%b.%e


to get an Future name something like:
C:\Temp\test HTML.html#delim#cProjects\ HTML\test HTML.html
C:\Temp\test.bm#delim#cProjects\\test.bm
(which shows that you have to take care with %b(5) expression for filenames with less then 5 chars.)


Then export Future name data to clipboard
- paste in editor
---- search for "#delim#c\"
- replace with "#delim#c:\"


Then set Expression back to "c:\Projects\\%b(5)\\%b.%e"

Just BTW (i hope this was no nonsense) ... back to work

104

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

OK, talking about editors featuring regex support:
Here are a few ones i can recommend,
like Siren they are Freeware/DonationWare , portable (no installation) and have a lot of features.

NotePad2   http://www.flos-freeware.ch/notepad2.html
PlainEdit   http://www.gaijin.at/dlplainedit.php  (German, but PlainEdit comes with english language too)
Notepad++     http://notepad-plus.sourceforge.net/
PSPad          http://www.pspad.com/


= = =   = = =   = = =   

Talking about AutohotKey
i have quickly searched an pseudo code for you, just to have an idea about:

(note: this is for CSV files, so simple search and replace TAB with , (COMA)  in somename.txt before)

Loop, read, somename.txt.csv,

   Loop, parse, A_LoopReadLine, CSV
  {
   CurrentField = %A_Index%
      if CurrentField = 1
        {
          Var1 = %A_LoopField%
        }
     if CurrentField = 2
      {
        Var2 = %A_LoopField%
      }

; here do an replacement
; StringReplace, OutputVar, InputVar, SearchText Var1 , ReplaceText Var2

  }

more support about AHK over at http://www.autohotkey.com/forum/

105

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

Hi Tommy, welcome!

Please note that Siren is an tool to modify the names of files, not the content of files.

But you can export an tab separated list of current and future name:

* do your settings / modifying of the file names  (i think: don't rename right now)

* right click on an column header
* click "Customize..."
* for Columns choose "Future name" only
* [OK]
* Edit menu => Copy the selection => List with header
* open notepad and paste the clipboard with Ctrl+V
* save this as somename.txt  (delete the first line)

(do here your renaming)

* now use an script tool like www.AutohotKey.com to modify your "simple text database file" based on somename.txt

Autohotkey can parse somename.txt line by line
and take the part from line start till the TAB into an var
and then the second part from TAB till the end of line in another var

- then search the "first var" in your "database file" -
and replace this by the "second var"

HTH?

Remember: always test with copies of your real files.

106

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

Q:  Hello, i want to remove the file name
      and add the name of the parent folders
      following by an counter, reseted by each new folder, if this is possible.


F.ex.
C:\Work\Project\Jan\list.txt         ==> Work_Project_Jan_001.txt
C:\Work\Project\Jan\report.txt    ==> Work_Project_Jan_002.txt

C:\Work\Project\Feb\list.txt         ==> Work_Project_Feb_001.txt
C:\Work\Project\Feb\report.txt    ==> Work_Project_Feb_002.txt





A:   That's easy.
1)   load your main folder "Work"   with "Choose Current Dir"
2)   load all sub-directories             with Ctrl+F5 "Load sub dirs"
3)   use an Expression like:            %p3_%p2_%p1_%np{ 3, 1, 1 }




Explanations:
%p : a parent directory, a digit can indicate the level     [%p1  is parent folder "Jan",    %p2 is grand-parent folder "Project",      %p3 is "Work"]
%np : the selection number relative to the file path
%np could be modified by { p, s, i }
p : size, f.ex 3 => 000,   5=> 00000
s : start
i : step



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


Press "F1" in Siren  for more help. (Help is search-able by pressing "Ctrl+F")


Siren Help wrote:

%p   : a parent directory
          a digit can indicate the level
   %pa  : the absolute path to the file (ending with a '\')
   %pr  : the relative path to the file (ending with a '\')
   %P   : Siren's current path
   For example, for "C:\IMAGE\SPORT\2006\IMG001.jpg"
          %p   gives "2006"
          %p2  gives "SPORT"
          %p3  gives "IMAGE"
          In non recursive mode:
          %pa  gives "C:\IMAGE\SPORT\2006\"
          %pr  gives "" (empty string)
          %P   gives "C:\IMAGE\SPORT\2006\"
          In recursive mode, if Siren's current directory
          is "C:\IMAGE":
          %pa  gives "C:\IMAGE\SPORT\2006\"
          %pr  gives "SPORT\2006\"
          %P   gives "C:\IMAGE\"

Siren Help wrote:

%n   : the selection number
   %np  : the selection number relative to the file path
          for example:
          File               %n        %np
          \Dir1\Img1.jpg     001       001
          \Dir1\Img2.jpg     002       002
          \Dir2\Img3.jpg     003       001
          \Dir2\Img4.jpg     004       002
   %nc  : the selection number relative to a name "collision"
          (same beginnings)
          the expression part following "%nc" is not taken into
          account.
          for example, with the expression: %dmd_%nc.%e
          File           Modif date     Result
          Image1.jpg     01/01/2004     20040101_001.jpg
          Image2.jpg     12/12/2004     20041212_001.jpg
          Image3.jpg     01/01/2004     20040101_002.jpg
          Image4.jpg     12/12/2004     20041212_002.jpg
          Image5.jpg     12/12/2004     20041212_003.jpg

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

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

There's much more in Siren Help...


.

107

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

Hallelujah, great it works big_smile

Good job Georges.

108

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

Some words to regex regular expression:

Yes there are pros you can wake up in the middle of the night and they tell you an correct 255 chars long regex ;-)

But we have to find our regex by trail and error :-(

1.) First we have to split our string/filename into parts: what we want to match, what is in front of this match and what is behind.
2.) Then we have to find the corresponding regex meta chars to match this parts
3.) Then we have to correct this meta chars mostly ;-)
That's the normal way and this goes only better if you have to spend time every day with regex questions so you have the right meta char "by hand". For others
it's the best to download an "one sheet regex syntax"-PDF,   ==>  http://www.ilovejackdaniels.com/cheat-s … eat-sheet/
print it out and lay it under the keyboard ;-)

Mostly you need only a few meta chars:
.      dot find one of ANY char
\s    finds an withespace / space / blank
\d    finds one digit
+    finds one or more of the left meta char (i.e. there MUST be something)
*    finds non or more of the left meta char (i.e. there must NOT be something)

And then by every use you will learn some more about regex and even can help other *sic*

Just my $0.02 of the day.

109

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

The Regex Coach is the tool i had in mind.

With this tool you can enter your file name and an reg expression
and then watch step-by-step how the engine works and match parts.

The Regex Coach - interactive regular expressions
http://www.weitz.de/regex-coach/

http://www.weitz.de/regex-coach/shot.png




The parse tree
If you select the "Tree" tab you'll see a (simplified) graphical representation of the parse tree of the regular expression.
This is how the regex engine "sees" the expression and it might help you to understand what's going on (or why the regular expression isn't interpreted as you intended it to be).

Single-stepping through the matching process
Finally, the "Step" tab will lead you to two panes which have the same content as the two main panes.
However, here you can watch the regex engine "at work". This is best explained with an example, so see the corresponding part of the tutorial. http://www.weitz.de/regex-coach/tutorial18.html

110

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

Huh O.O

let's see if i can handle this ;-)

We know an . dot finds one single char/sign.
So .+ finds one or as-many-as-possible till the last char/sign in the string/filename. That's how regex engines works.
An \s    (if you use .+\s)    finds one single withespace/blank, but only after the .+ is satisfied
And this is only if the .+ has cached all it could get. All chars, all digits, all blanks, all signs.
Yes, please note that the . dot find ANY char or sign, even whitespace blanks!   That's Fact!   Think like that! big_smile    It's the way it works.



> would you mind to explain "greedy" by simple words.
What is simpler then "get as many as you can get" ? big_smile
Maybe:
'greedy' find the right most match.
'Lazy' with ?-sign find the left most possible match.
i will post an link to an tool so you can watch how regex engine works



Since your real filename are different from your example filenames you have seen other results then i had expected.
Your right that .+\s finds the very last blank on the right.
So use .+?\s to let the engine match the first blank from the left.


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

Note:
i don't talk here about groups() because they don't matter for matching.
The groups are only good for you have somewhat you can refer back to later if you need the content of this match.
And i don't tell you that there are regex engines that works other way around like we talk about here big_smile That are for a further lesson big_smile (or read Mastering of RegEx big_smile)

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


You have
1;14 (Channel1 - 30112007 1330 169 MP2192g MP2192e AC320384g)_+0+0+160.mpg.abc

You want to have
1;14 (Channel1 - 30112007 1330 169 MP2192g MP2192e AC320384g).mpg.abc


1.) We have to search for ALL till an underscore  ===> .+_
2.) We have to search for ALL till the first dot      ===> .+?\.
3.) We have to catch the rest                             ===> .+



It also works if we move the dot from part 2 to part 3 (i think you want keep the dot?)
1.) We have to search for ALL till an underscore  ===> .+_
2.) We have to search for ALL                            ===> .+?
3.) till the first dot and catch the rest                  ===> \..+


I think you don't want keep the underscore but drop them?
1.) We have to search for ALL                            ===> .+
2.) till an underscore and search for ALL             ===> _.+?
3.) till the first dot and catch the rest                  ===> \..+


So i try an expression like => (.+)_.+?(\..+) and replace with \1\2        ===>   %f(s/(.+)_.+?(\..+)/\1\2/g)
We don't have to group the _.+? because we didn't need them later


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

Test it

Try

(.+)_.+(\..+)       ===>   %f(s/(.+)_.+(\..+)/\1\2/)

instead of
(.+)_.+?(\..+)      ===>   %f(s/(.+)_.+?(\..+)/\1\2/)

to see the greedy effect.

And we don't need the global 'g'-sign because we have only one occurrence of our match

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




> Search within Siren help didn't reveal any "global". Sorry!
OK. big_smile sorry.
Try:
1.) open Siren help with F1-key
2.) Strg+F to search
3.) search for regu
You there.
That 'g' means global i know from reading PERL RegEx manuals on the net.


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


> But why does \..+? not stop at . of .mpg?

This ?-sign you have to put to the   (-how do we call this?-)   last .+ group left before the \..+ group.
Because this last group should be lazy and stop before the dot we want to catch with the \.
So try  .+?\..+

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

I am afraid i didn't find the right words sad
Maybe you should join an real regex forum?

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

I hope i have covered all you questions, if not please nudge me ;-)

If you have more questions please ask.

Merry x-mas or what ever to all.



i hope no regex pro will read this stammering ever

111

(7 replies, posted in Comments)

Hi Rémi,
Meilleurs voeux a toutes et tous pour cette nouvelle annee !

Thank you for all your work with Siren and the new Siren 2.0!
You are a good programmer.


http://www.eckis.at/gifs/bilder/glockene009.gif

Merry x-mas to you, your family, your friends and all user of Siren and an happy new year.

I hope your dreams came through.

All the best

112

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

Here are an link about this topic:

Mastering Regular Expressions => http://www.oreilly.com/catalog/regex/chapter/ch04.html

It's about the technical behind RegEx, heavy stuff big_smile , i wish i could english :-(

113

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

Quick answer on the way:

If you expression finds the LAST occurrences instead the first ... you have to learn what GREEDY means big_smile
That's how the most RegEx engines works ... find-as-most-as-possible
So have you tried to  limit the match by using an question-mark ? ?
I don't know why your test find the the LAST... maybe you have other filenames then you provide us as examples?
But try to use something like .+? instead of .+



> Can you confirm that:
> (.+)(\s) considers everything before the LAST space and excludes the space
> (.+\s) considers everything before the LAST space and includes the space
No big_smile  (and a little bit YES because you may have seen such an result.... but didn't understood where it came from... so NO, that's not how it's work.. it's an side-effect only)


See:
. finds one char or sign
+ finds one or more from them you search for left of this +-sign
So .+ will find any char/sign if there is one or more of this "any" char/sign.

Example:
. finds an 'a' or one 'b' or one 'C' or one '-' or one '3' or... but only ONE of any sign. "Any sign" or char because you didn't know which char/sign will be in the filename.

If you want to find more then ONE you search for ANY char/sign and use an quantifier like * or +
So .+ find ANY...   but not ONE item only but as-many-as-possible .... till the RegEx engine find an other expression you search for.
As i sad.. the most RegEx engines are greedy and find more then you want.
So use the ?-modifier to search "lazy"


The only difference between  (.+)(\s) and (.+\s)  is that you first have split the match into two groups rather then using one group for back referencing.
Using two groups is good if you want to leave one group content out of the replacement.
If you have two groups you can choose which content from which group you want... group one \1, or group \2, or both \1\2.
With one group you have simply no choice ;-)


See this link for an overview about RegEx syntax
http://www.regular-expressions.info/reference.html
http://scarabee.software.free.fr/forum/ … php?id=131


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


> Why is the "/g" at the end of RegEx (s/search/replace/g)?
g means global and search not only for the first occurrences in an string but for all. See Siren help too.
You may play with this modifier as well as with all the other RegEx  meta chars to find the right expression for you.

Damn big_smile it's now longer as i want to wrote big_smile

So do you need more help? Should i post the answer?


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

> %f(s/(.+)(\_.+)(\..+)/\1\3/g)

You don't have to escape the underscore since this is no meta character from RegEx. That would be [\^$.|?*+()
Simple use (_.+)


Good work so far Georges. Do you want me to present the solution or do you want "learning by doing"?   You choose.

114

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

Hi, re-reading your post

> Everything after the underscore (which is unique in the filename base) needs to be disregarded.

you could also search for ALL till an underscore till an dot and then the rest
and then leave out all from underscore till an dot.

That's your challenge for the feasts holidays big_smile




And, ooh, you wrote    "> Everything after the underscore"     so the underscore should not be dropped???

115

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

I think it's no matter how many extension you have since we match from the left.
Let's try to but the string 'expr1 (expr2)_expr3.ext1' into RegEx parts:

expr1 (expr2)_expr3.ext1

1) Find any char one or more time             .+            expr1                till you find an occurrence of the next part, here the space
2) Find an space                                       \s
3) Find an open bracket                            \(             (
4) Find any char one or more time             .+            expr2                till you find an occurrence of the next part, here the closing bracket
5) Find an close bracket                            \)             )
6) Find any char one or more time             .+            _expr3              till you find an occurrence of the next part, here the dot
7) Find an dot                                           \.            .
8) Find any char one or more time             .+            ext1 or ext1.ext2

Note: for an proper result it may be you have to use an ?-char to match non greedy ==>   .+?


That would be an expression like:                           .+\s\(.+\).+\..+                 (Or   .+?\s\(.+?\).+?\..+   to match non greedy)

Now we group () all parts for back referencing:      (.+\s)(\(.+\))(.+)(\..+)           => for better reading =>  (.+\s)  (\(.+\))  (.+)  (\..+)

I use this expression on the hole filename ==> %f

The "frame skeleton" for RegEx search and replace in Siren 2 is    ==>  (s///g)   ==> (s/search/replace/g)   ==>  %f(s///g)

So we use this expression in Siren  ==> %f(s/(.+\s)(\(.+\))(.+)(\..+)//g)      => for better reading =>  %f(s/    (.+\s)  (\(.+\))  (.+)  (\..+)    //g)


Now  you can refer back to the contents we catch in the groups()  by using \1 and \2 and so on 
==> use this between the last two // right before the g)  ==>  %f(s/ /\1\2\4/g)

Try your self adding thoose \1 \2 \3 \4 thinggy to see whats happens ;-)

At the end you should use an RegEx expression like  ==> %f(s/(.+\s)(\(.+\))(.+)(\..+)/\1\2\4/g)   because you want drop part three \3


HTH?

116

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

Hi all.

Georges, is 'expr3' always an same expression or is 'expr3' always on the same place but different words???
In case of the first then Rémis solution would work.
For the second case an RegEx would work.

This need Siren 2.0 or above.

Q:  I want to help someone who have posted a few examples he have problems with.
      Now i have to create this files to test my expression before i post them.
      Can i use Siren to my aid to make this more quickly?



A:  Sure you can.  (This batch work in Windows 2000 and above only)



Do this onces:

1.) Create an folder (if you want) like "C:\mySirenTests"
2.) Create an new text file named e.g. "_CreateFiles.cmd"
3.) Copy and paste the followed code into this new _CreateFiles.cmd file

@ECHO OFF
SET myFileName=newxxxyyyzzz
set /p "myAmount=How many files do you want to create?"
for /l %%i in (1,1,%myAmount%) do (copy nul %myFileName%_%%i.txt >NUL)

Save this as _CreateFiles.cmd (Attention, Notepad wants to add an ".txt" what we didn't need!) into "C:\mySirenTests"
Now you should have "C:\mySirenTests\_CreateFiles.cmd"

.

.

Do this every time you need new test files:

0.) Go into your test folder  "C:\mySirenTests"
1.) Execute the batch "_CreateFiles.cmd"  by double click
2.) Answer the question "How many files do you want to create?"  e.g. with '4'
3.) Press ENTER, your done.  Four new files called like  "newxxxyyyzzz_1.txt"  are created.

4.) Go to the browser and copy the names of the examples file names to the clipboard.

5.) Start Siren 2.0 and go to your test folder "C:\mySirenTests"
6.) Select the new created temp files "newxxxyyyzzz_1.txt" and set the marker in front of them

7.) Use the new introduced variable %C  as expression    [ %C   : line extracted from the clipboard following the file selection order ]

     See, ...  the 'Future names' of the  temp files  ...   have now the names of the examples.

8.) Press RENAME and your done. Now you have the same file names as the quester.


.

118

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

Edit:
> not needed here! ... don't know why!

Surely i KNOW why ;-)

we search for an opening bracket:                      (
followed by one or more chars or signs:              .+
followed by an closing bracket:                           )
followed by none or one or more chars or signs:  .*
followed by the end of the file name:                   .%e

is pretty accurate i guess ;-)

119

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

Hi Georges,
i guess your "expr3" is not always the same chars? Would be to simple.

The trick is to find something what is common with all this different file names,
if we didn't find something common we have to first separate the files we need or do it in several passes.

But i see one common thing: (expr3) is always at the end of the file name....right?

So we search for:
The base file name:              %b
start an regEx:                    (s/
all in front:                         (.+)               Group () 1
but no opening bracket (:    [^\(]              not needed here! ... don't know why!
till an opening bracket (:     (\()                Group () 2
all:                                   .+                  an another group, what we need not longer so we didn't use ( and ) here
till an closing bracket:         (\))                Group () 3
the rest if any:                   (.*)                Group () 4
end the regEx search:         /
do the replacement:           \1\2\3\4          replace whit what we have found with Group 1, Group 2,...
end the regEx:                  /)
add an dot and the ext:     .%e       

So i would do with Siren 2.0
Expression: %b(s/(.+)(\().+(\))(.*)/\1\2\3\4/).%e


HTH? :-)
What is that with those [1] thinggies? I didn't understood. You want them or not?

And you didn't mentioned
"expr1 (expr2).ext"
and
"expr1 (expr2) [1].ext"

this would also be affected and deleted with my RegEx.

I guess you have to put your files you want to rename apart first?
Or rename your  "expr1 (expr2).ext"  first to e.g. "expr1 [expr2].ext"  and later back.
It's hard to guess without you provide some real  file names. (If you do this make an list with one name at an row only, and without comments or quotes please, so i can copy them at easy and create files with this names. See http://scarabee.software.free.fr/forum/ … hp?id=187)

120

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

Find me: renaming error duplicate duplicates pairs same name dublikat doppelt double   twice two of a kind zweimal doublement géminé, géminée même pair identique, identique  nom de fichier

121

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

Hi Georges, welcome.


In Siren press the F1-key
and search for> coll
and you can read

%nc  : the selection number relative to a name "collision"
          (same beginnings)
          the expression part following "%nc" is not taken into
          account.
          for example, with the expression: %dmd_%nc.%e
          File           Modif date     Result
          Image1.jpg     01/01/2004     20040101_001.jpg
          Image2.jpg     12/12/2004     20041212_001.jpg
          Image3.jpg     01/01/2004     20040101_002.jpg
          Image4.jpg     12/12/2004     20041212_002.jpg
          Image5.jpg     12/12/2004     20041212_003.jpg
          Image6.gif     12/12/2004     20041212_004.gif
   %ncs : same principle as "%nc" except that it is empty for
          the first element of the "collision group" and prefixed
          by a "_" for the others.
          for example, with the expression: %dmd%ncs.%e
          File           Modif date     Result
          Image1.jpg     01/01/2004     20040101.jpg
          Image2.jpg     12/12/2004     20041212.jpg
          Image3.jpg     01/01/2004     20040101_001.jpg
          Image4.jpg     12/12/2004     20041212_001.jpg
          Image5.jpg     12/12/2004     20041212_002.jpg
          Image6.gif     12/12/2004     20041212_003.gif
   %ncf : Same as "%nc" except that the path is not taken into
          account. Only the file name parts are compared
   %ncfs: Same as "%ncs" but on the file name parts

I would use %ncs




This How to mentioned this behaviour too:
http://scarabee.software.free.fr/forum/ … php?id=112

The variables "%nc" and "%ncs" give a unique value avoiding
   name "collisions".
   Use an expression like: Planet_Mars_%Xdo%ncs.jpg

HTH? big_smile

122

(6 replies, posted in Evolution requests)

To automate Siren or to use an script language for advantages renaming we can use an VBS script, or AutoIt or AHK (AutoHotKey)

AutoHotkey can be freely downloaded at www.autohotkey.com
No installation needed if you download the ZIP archive. Just unpack and run the autohotkey.exe

Here is an Script for the upcoming Siren 2.0
which just copies the current selected "current file name" to the clipboard
then parse this clipboard contain line by line
and do .... nothing (that's your part to do).
Then the output is collected together an put back to the clipboard.
Then the focus is set to Siren (if not already, just to be sure),
the expression field is cleared and the new var from Siren 2.0 %C is typed in.
Then the Selection is inverted two times to refresh the "Future names"

;If WinActive("ahk_class Siren_Window_Class")  ; execute this only if Siren has the focus (exec from user menu)
;{
  WinWaitActive, ahk_class Siren_Window_Class  ; wait till the Siren window has the focus
  Send ^+P                                     ; execute the Siren hotkey Ctr+Shift+P to copy the current name to the clipboard

Loop parse, clipboard, `n                      ; split the clipboard containt by CRLF
{
   myLine :=A_LoopField                        ; put each line temporary in the var myLine
 
   ;your code here for each myLine (file name) ; do something with this line i.e. file name
   
   myOut = %myOut%%myLine%`n                   ; collect all myLines for the output
   }
StringTrimRight myOut, myOut, myLine           ; cleanup the line
clipboard := myOut                             ; set the clipboard to your new output
;MsgBox %myOut%
WinActivate,  ahk_class Siren_Window_Class     ; wait till the Siren window has the focus
ControlFocus, Edit1, Siren                     ; give the EXPRESSION combo box the focus
ControlSend, Edit1, {BS}, Siren                ; press an back space to clear the EXPRESSION box
ControlSendRaw, Edit1, `%C, Siren              ; send the Siren shortcut %C
Send ^i                                        ; to refresh Siren invert the selection by press Ctrl+I
Send ^i                                        ;                   and invert it again to the original selection
;}
Return

Note: I'm no expert, so please test this before use with original files.

.

123

(6 replies, posted in Evolution requests)

I mean this this time independent from any selection to make it easy for you.
The Tools even have nothing to do with your SysListView321 (see f.ex. Notepad myTips.txt have nothing to do with any selection)

I simply use SendKeys in an VBS script to execute 'Ctrl+Shift+P' 
to export the selected current file name to the clipboard
and modify this clipboard contain .....
to put this modified names back to the clip board and use the new variable %C


So, yes
> They have to be executed once for all (not file selection related)


This tool menu is meant simply to have the easy access to execute other apps.
In this app/scripts i use Ctrl+Shift+P and %C or %T to interact with Siren.
So i guess you have no work to implement scripting possibilities into Siren itself.

124

(6 replies, posted in Evolution requests)

I think i have wrote smtg like this somewhere else ... but now i didn't find it again.

So once again please: can we have an "user commands" menu ?

I can do this without this user menu too, but so i have all i need in one app accessible.



I suggest an menu where i can execute commandos to start scripts or execute other apps.
I would like to start f.ex.:
* Notepad.exe   myTips.txt
* rename.vbs
* renameIT.ahk
* createFiles.cmd

Minimum 20 entrys perhaps.


That way we can make Siren scriptable by execute an VBS or AHK with f.ex.

SENDKEYS Ctrl+Shift+P         ; copy current names to the clipboard
...
modify CLIPBOARD              ; modify this names with e.g.  'Split Clipboard'   or  store Clipboard to a new file and parse this with SED or AWK or or or
...
ACTIVATE , Siren_Window_Class   ; set the Siren window active
ACTIVATE , Edit1                          ; set the expression box active
SENDKEYS %C                             ; insert the expression %C

.

.
What do you think? Is this many work for you?

Fine would be if you could show the contains of an sub folder in this user menu
so we could sort the files in sub-sub folder and see the files in sub menus of the user menu.
f.ex.
C:\Siren\Tools\1.cmd
C:\Siren\Tools\Info\tip.txt
C:\Siren\Tools\Favorites\rename.au3

gives the menu
Tools |
        | 1.cmd
        |Info | tip.txt
        |Favorites | rename.au3

Q:  I want to sort by the fifth letter of the name.

     asd-Anton.txt
     asd-Tom.txt
     asd-Victor.txt
     asd-Wayne.txt
     hif-Anton.txt
     hif-Tom.txt
     hif-Victor.txt
     wrt-Anton.txt
     wrt-Tom.txt
     wrt-Tom second.txt
     wrt-Victor.txt

     I want to sort by the given name like Anton, Tom or Victor.




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

        Use Ctr+B to choose your directory. Single click on it and choose OK
        You can use the filter combo box  to see only files you want to.  (like here   *.txt)


Psst, now we do an insider trick.

Step 1.)
Use as
EXPRESSION: %b(5)
but don't rename it now!

As "Future name" you will see now:
     Anton.txt
     Tom.txt
     Victor.txt
     Wayne.txt
     Anton.txt
     Tom.txt
     Victor.txt
     Anton.txt
     Tom.txt
     Tom second.txt
     Victor.txt


Step 2.)
Now click on the header of the "Future Name"-Column. Now the files are sorted by the names in the Future Name-Column.
     Anton.txt
     Anton.txt
     Anton.txt
     Tom.txt
     Tom.txt
     Tom.txt
     Tom second.txt
     Victor.txt
     Victor.txt
     Victor.txt
     Wayne.txt


The  "Current Name"-Column is sorted this way too
     asd-Anton.txt
     hif-Anton.txt
     wrt-Anton.txt
     asd-Tom.txt
     hif-Tom.txt
     wrt-Tom.txt
     wrt-Tom second.txt
     asd-Victor.txt
     hif-Victor.txt
     wrt-Victor.txt
     asd-Wayne.txt


Step 3.)
Clear the EXPRESSION field %b(5)  .....  and continue your renaming task that you want to do before we have done the sorting.



Read this thread for more information about sorting:   http://scarabee.software.free.fr/forum/ … php?id=136






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