#1 2013-03-26 20:59

ezitb4me
Member
Registered: 2013-03-26
Posts: 2

Fill With Spaces to Specified Position

I need to fill with spaces after the first part of a filename to reach a specific position (i.e. 40):

(From)
Artist1 – song 1
Another Great Artist 2 – Yet Another Great Song 2
More Artists – Even More Songs

(To)
Artist1                              – song 1
Another Great Artist 2        – Yet Another Great Song 2
More Artists                       – Even More Songs


All Artists and Titles are separated with (space) (hyphen) (space)

Any thoughts?

Last edited by ezitb4me (2013-03-26 21:28)

Offline

#2 2013-03-26 22:40

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Fill With Spaces to Specified Position

From:
Artist1 - song 1.mp3
Another Great Artist 2 - Yet Another Great Song 2.mp3
More Artists - Even More Songs.mp3

To:
Artist1                                   -  song 1.mp3
Another Great Artist 2                    -  Yet Another Great Song 2.mp3
More Artists                              -  Even More Songs.mp3



best use a PascalScript
which adds a lot of blanks to every name, only to fit the longest needed length,
then cut all to 42 signs:

var
  P1, P2: WideString;
  MarkerPos, PadLength: Integer;
begin
  PadLength := 42; //wanted length

  MarkerPos := Pos('-', FileName);
  if MarkerPos > 0 then
    begin
      P1 := Copy(FileName, 1, MarkerPos - 1); //get first part before hyphen
      P1 := P1 + '                                                  '; //add many blanks
      P1 := Copy(P1, 1, PadLength); //get first 42 signs
      P2 := Copy(FileName, MarkerPos + 1, 999); //get second part behind hyphen
      FileName := P1 + '- ' + P2; //build new file name
 end;
end.

(read our wiki for an how-to >> http://www.den4b.com/wiki/ReNamer:Rules:PascalScript)





big_smile  you can even do this without an script:

//change extension to get a new "base name":
1) Replace: Replace last "." with "?"
2) Replace: Replace first " - " with "."
>Artist1.song 1?mp3
("Artist1" is now base name, ".song 1?mp3" is now the extension)

//do the work on current, temporary base name:
3) Insert: Insert "                                                        " as Suffix (skip extension)
4) Delete: Delete from Position 42 until the End (skip extension)
>Artist1                                    .song 1?mp3

//change ext back:
5) Replace: Replace first "." with "- "
6) Replace: Replace last "?" with "."
>Artist1                                    - song 1.mp3




HTH? big_smile


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2013-03-27 02:07

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

Re: Fill With Spaces to Specified Position

HI ezitb4me,

Welcome!

If you use filename-to-tags operation in a tag editor, probably the variable number of spaces will mess up the tags.
For example, the same artist's name with different number of spaces will be considered as sung by a different artist! yikes
So when you load these songs in your smartphone, you will be presented with hundreds of artists...

Just a thought.

Offline

#4 2013-03-28 11:00

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: Fill With Spaces to Specified Position

Don't get me wrong but are you sure of what you are doing?

Each character (unless in monospace typography, not the most common), has a different measure in pixels, is near to impossible to get them perfectly aligned.

Also, it is very unpredictable how they will behave in different places, seeing the file in column view will be different than as icon. And if you are seeing it in columns, shouldn't it be more recommendable to make use of the meta tags of the file, to just show this other things in the corresponding column?.

And, apart from that, systems don't tend to like very long names, and you could come into trouble if a name exceeds a certain limit...

Just my point of view...


If this software has helped you, consider getting your pro version. :)

Offline

#5 2013-03-28 16:04

ezitb4me
Member
Registered: 2013-03-26
Posts: 2

Re: Fill With Spaces to Specified Position

Stefan,

I had excellent success using the non-PascalScript method you provided!

You have my deepest gratitude, respect and admiration and I sincerely thank you for the solution.

-EZ

Offline

Board footer

Powered by FluxBB