Page 1 of 1

Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 09:29
by Biggynuff
Hi

I've found the renaming feature of XY to be very useful indeed for batch renaming huge numbers of images etc (holiday snaps - don't ya just love em! :lol: )

I was wondering if there was anyway of 'tweaking' the rename options that appear under the right click menu?

For instance, I have gathered quite a collection of regularly used 'batch rename' operations and 'search and replace' patterns that appear in the drop down box of the rename function. I just wondered if anyone has managed to give them a user-friendly name or have them appear on right click as your commonly used rename patterns?

The built in patterns on right click are great and the feature is superb, but it's just a thought about how this could be more user friendly and quicker to use

Any thoughts?

I did search on this and haven't found anything specific

Thanks

(I'm off to the sea-side for the day - my wife wants to take more pictures of 'crashy bangy' ocean . . . still, it gives me another excuse to spend time sorting out the files on XY !!!!! 8)

Don, this software is so good I'm sometimes disappointed that I can do things so quickly - how's that for irony :?: )


I am in love with XY . . . is she single?

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 10:03
by j_c_hallgren
Not sure if this helps or you already know this, but the prior 'batch rename' entries and such can at least be resequenced and/or cleaned up via the List Management function (and thus via the LM toolbar icon)...this can come in handy to reduce the clutter and move your most used ones to the top..

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 10:17
by admin
Biggynuff wrote:I am in love with XY . . . is she single?
Yes, but beware, she's very promiscuous...

You should dive a little into scripting. It's disappointingly easy :wink: to create a custom toolbar button that drops a menu with custom rename jobs...

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 12:18
by Muroph
Biggynuff wrote:I have gathered quite a collection of regularly used 'batch rename' operations and 'search and replace' patterns that appear in the drop down box of the rename function. I just wondered if anyone has managed to give them a user-friendly name or have them appear on right click as your commonly used rename patterns?
i think the easiest solution is to create User Defined Commands for those rename patterns.
then you can assign a keyboard shortcut for them for quick access.
you can also create a Custom Toolbar Button with the command "#7;" to pop-up the "user -> rename" menu.

that's what i did with my 2 or 3 dozen favorite rename patterns. :)

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 15:20
by Biggynuff
Thanks guys,

Some excellent suggestions here

You're absolutely right Don, I must become more involved with scripting. I just have this in built fear every time I look at the smallest section of code . . . I dont know why but it just scares the life out of me having never programmed before!

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 15:37
by admin
Biggynuff wrote:Thanks guys,

Some excellent suggestions here

You're absolutely right Don, I must become more involved with scripting. I just have this in built fear every time I look at the smallest section of code . . . I dont know why but it just scares the life out of me having never programmed before!
Post 2 or 3 of your preferred rename jobs (patterns) and I post a copy and paste solution for a user button. From there you will be comfortable to expand...

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 19:44
by Biggynuff
Thank you Don,

I feel a bit silly now because I've realised that many of the suggestions above were things I should have found myself. Anyway, can't thank you guys enough

I've now prepared some of my common patterns as UDC's on the 'user' menu. Wonderful!

The thought of having some on a user defined button is very interesting indeed . . .

Here's a pattern I use for replacing common words with first letters in 'upper case' as part of filenames. It also replaces '_' with spaces etc. It's a 'search and replace':

_|.|And|Or|With|It|To|In|Of|The>> | |and|or|with|it|to|in|of|the (UDC: #1405;)

Another one I just love (and so simple in XY!). Just adds any text to the beginning of a file name. A 'batch' rename:

Text goes here - * (UDC: #1408;)

I use these A LOT. If you could give me an example of how to place these on a user button I'd be very grateful

Thanks all :?


.

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 20:12
by admin
Ok, here ya go.
1) Add a new User Button to the toolbar (you know how to do this?)
2) Copy the code below to the clipboard
3) right-click the new User Button in the toolbar; a dialog should open (if not select Edit... from the context menu).
4) right-click anywhere in the grey empty space of that dialog; then select Paste (see screenshot) and close the dialog.
5) done! select some testfile and try out the button...

Code: Select all

Snip: CTB 1
  XYplorer 9.20.0207, 13.07.2010 20:05:44
Name
  Biggynuff's Rename Button
Icon
  :rename
ScriptL
  "And > and, etc." rename "s", "_|.|And|Or|With|It|To|In|Of|The>> | |and|or|with|it|to|in|of|the"
  "Prefix Text" rename "b", "Text goes here - *"
  -
  "Append modified date" rename "b", '*-<datem yyyymmdd>'
ScriptR
  
FireClick
  1

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 20:21
by Biggynuff
Don,

I am speechless :| . . . not just for the incredible power of XY but for your help and assistance

Thank you so much, it works wonderfully and I can easily modify it and add to it

I will take your advice and learn more about scripting. I really will try!

Thanks


.

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 22:16
by Biggynuff
Well . . .

I said I'd give it a go, so I gave it a go!

The script above is very nice and I can easily expand on it, but I thought "how nice would it be if my 'Prefix text' option could actually ask me what text I wanted to add at the start of the file name", rather than having to edit the script file each time?

Here goes:

Code: Select all

"And > and, etc." rename "s", "_|.|And|Or|With|It|To|In|Of|The>> | |and|or|with|it|to|in|of|the"
"Prefix Text" $string = input("Enter the text to prefix:"); rename "b", "$string*"
-
"Append modified date" rename "b", '*-<datem yyyymmdd>'
The part I've changed is the second line. It now opens a text input box, I type in the box and the string is allocated to a variable. I then use the variable as the 'argument' for the batch rename

This will no doubt seem simple to most readers here, but for me its a miracle of IT technology and a groundbreaking advance in my programming expertise :lol:

Of course, I can add as many 'pre set' text patterns to prefix as I like, along with other renaming options, but the above seems to work and I'm delighted with it as a first go 8)

Please, if anyone sees any glaring errors or pitfalls I've fallen into I'd be grateful for any comments

Should this be in the scripting section?

Anyway, thanks very much everyone :P


.

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 22:22
by admin
Wow! If that's really your first steps in programming you sure got talent! And you feel the fun of it. Beware, programming is highly addictive! :)

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 22:52
by Biggynuff
Ha Ha!

Thanks Don. I've had my head burried in your help file, the 'Wiki' web page and dissecting other users scripts on here for a few hours

It's gonna take some time but I'm determined to get into this more. I did some initial experimenting a while ago but never really got anything to work. I'm over the moon with this! :P

Thanks once again


8)

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 23:20
by Biggynuff
How about this?

Code: Select all

"And > and, etc." rename "s", "_|.|And|Or|With|It|To|In|Of|The>> | |and|or|with|it|to|in|of|the"
"Prefix Text" $string = input("Enter the text to prefix:"); rename "b", "$string*"
"Search and Replace" $find = input("Enter the text to be replaced:"); $replace = input("Enter the text to be inserted:"); msg "Replace: ".$find." with: ".$replace; rename "s", "$find/$replace"
-
"Append modified date" rename "b", '*-<datem yyyymmdd>'
I can highlight many files, click the button, select 'Search and Replace' then enter two text strings - one to find and one to replace it with. I then get a confirmation box before the files are renamed

Again, I'm sure it's just a trivial matter for XY but . . .

WWWWWOOOOOOOOWWWWWWWWWW!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :lol:

Must dash. I now have to learn how to present an 'ok' or 'cancel' option when the message with the strings is displayed. It's only a matter of time, and world domination is not that far off with XY :P


8)

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 23:37
by admin
:D

Tip: rename takes a 3rd argument "p" which gives you a preview before anything happens, e.g.

Code: Select all

rename "b", '*-<datem yyyymmdd>', "p"

Re: Can we 'tweak' the file renaming templates?

Posted: 13 Jul 2010 23:48
by Biggynuff
:lol:

Works like a charm!

Thanks Don