Rename to 'file' of 'total files'

The third one works fine too, can't really see an immediate use for it at the moment, but that doesn't mean there isn't one. ta :slight_smile:

Now that we have the second script working, we are part way there. Zero padding and it is golden for adding the 'of num' to existing properly named files. Excellent :slight_smile:

However, unless there is a way to incorporate this script into a button that effectively rebuilds the file name from scratch, then we are only half way there. Just so you don't have to reread the entire thread, here is the bit that counts.

Your 2nd script does the first part of the above nicely (even perfectly once the zero padding is added :wink: ), but it doesn't do the second part.

I don't mind being old 99% of the time, but this is one time I wish I was young so I could learn scripting with my young brain.

@Jon, what chance adding a new code, to save us? :slight_smile:

Easier to get the first script working I suspect :slight_smile: It must be possible since it works for tbone. Maybe you just need to re-download/install it.

Since when was easy the way to go? Anyone can do easy :wink:

I will reget it, and redo it, though I did that twice already.

The thing with the second script is, zero padding aside, it is kind of a one trick pony. It does what it does, and it does it nicely, but I can't bend it to my will (either because I don't know how or because it cannot be bent.)

If it was a standard Opus command, the next thing I would do is add a bit more automation, eg.

select none
select *.mp3
run the command to do the rename thing

This automates the whole thing. I don't know how to do that with scripting, and I can't come asking tbone to cater to my every whim, and I don't know if a STANDARD button can somehow coexist with a scripted one, in other words, combine the first two lines of my button above, with his script as the third line.

Anyway, it is time for bed in the land down under. Tomorrow is a new day, with new solutions! :unamused:

AHA!
I discovered why it didn't work.

It is because the files I was trying it on already HAD numbers on them!
AND, to add further confusion, it does some weird stuff if there are more than 7 numbers.

Time of Death - Part 01.mp3
Time of Death - Part 02.mp3
Time of Death - Part 03.mp3
Time of Death - Part 04.mp3
Time of Death - Part 05.mp3
Time of Death - Part 06.mp3
Time of Death - Part 07.mp3
Time of Death - Part 08.mp3
Time of Death - Part 09.mp3
Time of Death - Part 10.mp3
Time of Death - Part 11.mp3

If you select the first 7 of these, NOTHING HAPPENS, which is what I was seeing all along. I was working in a dir that only had 6 files as it happens, so no matter what I did, nothing happened, hence my comment.

Anyway, select 7, still nothing happens, select 8 though... and this is what you get

Time of Death - Part 01.mp3
Time of Death - Part 02.mp3
Time of Death - Part 03.mp3
Time of Death - Part 04.mp3
Time of Death - Part 05.mp3
Time of Death - Part 06.mp3
Time of Death - Part 07.mp3
Time of Death - Part 8 of 8.mp3

Put the name back manually, select all 11, and you get

Time of Death - Part 01.mp3
Time of Death - Part 02.mp3
Time of Death - Part 03.mp3
Time of Death - Part 04.mp3
Time of Death - Part 05.mp3
Time of Death - Part 06.mp3
Time of Death - Part 07.mp3
Time of Death - Part 10.mp3
Time of Death - Part 11.mp3
Time of Death - Part 12 of 11.mp3
Time of Death - Part 13 of 11.mp3

where the last two are actually... 8 becomes 12 of 11, and 9 becomes 13 of 11! lol

I know this because the tags tell me the numbers, and I can see the actual happenings in the script output log.

IF the files have NO numbers on them, the script works beautifully, BUT, in practice, this will never happen, because the files are ALWAYS numbered (after some fashion). They have to be, to preserve the correct play order.

So, we have solved the "this button does nothing" problem, now if only we could....

Time for bed. ahhh, this is almost like the old days. Flat mode, so good.

GAH, I must be on drugs. This is why you shouldn't do this stuff at 2AM. Sleep is for the weak I know, but...

Even the 2nd button, which I said works fine, doesn't 'really' work, because it can't be used when the files have numbers, which they always do! This is because it doesn't add simply "of <totalnumberoffiles?" it adds of , which is no good IF you are applying the rename to existing files WITH NUMBERS.

What I said back at the start was that I needed a way to...

let's call the future pretend command say {totf}

  1. add 'of {totf}' to existing filenames
    AND
  2. to be able to incorporate the sequential numbering sytem with {totf} so I can build file names from scratch.

So in the first case, it would simply rename all files, (regardless of whether they were numbered or not) from .mp3
to of {totf}.mp3

In the second case, it would rebuild the file name from scratch, prompting for a base name, then adding the sequential number, then adding the total number, so

.mp3
.mp3

becomes

[#] of {totf}.mp3

The first script of tbone's actually does the latter, BUT, it only works IF the files don't have numbers already. lol, Joseph Heller eat your heart out :slight_smile:

So, we are back at the start, and I am really going to bed!

Install this new script command:
RenameEx: Command: RenameEx (extended Rename command)

Regarding your topics:

  1. Create a button or call:
    RenameEx NUMBER PAD TO="{stem} of {totalsel}{ext}"

  2. Create a button or call:
    RenameEx NUMBER PAD TO="{dlgstring|New filename:|{file}} - {num} of {totalsel}"

Perfect, absolutely perfect. Well, so far anway. One small point for anyone looking, add {ext} to the second command. eg

RenameEx NUMBER PAD TO="{dlgstring|New filename:|{file}} - {num} of {totalsel}{ext}"

Otherwise you'll end up extensionless :slight_smile:

Many thanks tbone, nice job. Now that this is a defacto command, it can be bent to my will :slight_smile:

Much appreciated.

Job done!

Maybe {file|noext} would be better than {file}, since the extension is being added back on the end automatically.

I'll take your advice Leo, thanks. Now we have a new command, ahhh. :slight_smile:

Yep Leo, using {file|noext} is better! o) The reason for the missing {ext} in my example must have been the late night! o)
I actually wanted to do something totally different yesterday, now Biggus, what about you come around and help me catch up on the things I left untouched? Speaking of doing some cleaning and prepping the motorbikes, you look like a rider! o)

1972: Honda 750 4
1974: Kawasaki Z900
1978: Kawasaki Z1000
2012: Kawasaki KLZ1000

So yeah, you could say I was a rider :slight_smile:

Mate, if it is within my ability, I am more than happy to help. Thanks for the work on this one. Much appreciated.

Let's have a tour! o) I also own some "Kawas", I have a Z650 (82) and a rotten Eliminator EL 250 (95), which I currently rebuild.
Do you still have the z1000? These old models sell on ebay for thousends of EUR, insane for such old metal. Drive save! o)

Nah, I sold it, and yeah they are worth a squillion now, though not as much as the 9, because it was one of the special ones from the movie "Stone". You may not have heard of it over there, but it is very much a cult classic here. Watch it if you can find it, it is cool, but make sure you get the uncensored ending version.

We better shut up before we get into trouble. Thanks again for the script. A couple of people are using it for their books, and they LOVE it :slight_smile:

Hello,

I have tried out some of these various naming and numbering scripts throughout this thread, at first I was unable to get them to work, but now I think they are working.

I don't currently have a use for them at the moment, so they do not need to be fixed for me specifically, my reason for trying them was more to test how to apply user created scripts, but I ran into some things with some of these scripts that I thought I would share / ask about.

When you run a renaming job of multiple files through the Advanced Renamer it applies all the renames, but if you make a mistake and want to undo, it undoes all the multiple files renamed all at once. Not sure why but when you run an undo after running some of these scripts (like this one 1 of 4, 2 of 4 or the (1) (2) one) it only undoes the last file renamed?

The only reason I ran into this need to undo was because I tried this script out with some files that already had numbers in the file names. It seems if you run these continuous based numbering scripts (like this one 1 of 4, 2 of 4 or the (1) (2) one)
on files that have numbers already in the file names, the script gets confused due to the numbers already existing and can output some interesting results.

Not sure if these explanations make any sense or if others have experienced any of the above, but just thought I would share my findings just in case anyone tries them in the future with files that already have numbers.

Overall though these are some great scripts.
Thank You

If you have trouble running something, especially if it's related to renaming things, it's much easier to help if you show some example filenames and the commands you run (from a button or commandline). You can copy and paste selected filenames easily (look into the "Edit" menu). Now you say you were just trying, so we are good, but maybe remember this the next time you have problems looking for serious help. o)

Thanks. o)

Shoot tbone sorry about that, on top of that I missed that this post has a page 2 and Biggus mentioned he ran into similar things with file names with numbers in them. At the time I couldn't get your RenameEx to work but now that I do I see that you corrected some if not all of these things using that script instead. For some reason I am drawing a blank at how RenameEx handled file names with numbers, but I remember testing the undo and that works great with RenameEx, meaning if you rename multiple files all at once and then you do an UNDO it undoes every single file rather than the last file renamed like the script in this thread does.

I will still give some examples you requested just in case they may be helpful?....

"UNDO" EXAMPLE
Book On Birds
Bird Book
Birds Chapter

When you run this script entering "Books About Birds" you get
Books About Birds 1 of 3
Books About Birds 2 of 3
Books About Birds 3 of 3

Which works great, but if you hit undo you get
Books About Birds 1 of 3
Books About Birds 2 of 3
Birds Chapter (only undoes this file as opposed to all three)

FILE WITH NUMBERS EXAMPLE A
Book On Birds 1
Bird Book 3
Birds Chapter 6

If you run this script on these files it will not do anything because each file contains a number in it.

FILE WITH NUMBERS EXAMPLE B
Book On Birds (Removed number from file)
Bird Book 3
Birds Chapter 6

If you run this script on these files you get
Bird Book 7 of 3
Bird Book 3
Birds Chapter 6
It takes the name of middle file and it takes the number "6" from the third file, numbering the first file as "7 of 3"

Hopefully this was in some way helpful.
Thank You for all the scripts you have been creating, great stuff, very helpful.

As I mentioned in other posts to you, many of these scripts don't seem useful to me at first, I didn't think I would use this
one, but the more I think about how it can be used, looking around at all my files it seems I have many multiple part files that this would be really useful at cleaning up their names.

For you and other users, I would probably put ( ) to each side of the suffix
(which I think should work in RenameEx I have to try this)
So instead of for example
Bird Book 12 1 of 2
Bird Book 12 2 of 2

It would look like
Bird Book 12 (1 of 2)
Bird Book 12 (2 of 2)

Just in case files have needed numbering at the end of the file names, it kind of eliminates any confusion between the numbers.