Help with rename script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Help with rename script

Post by serendipity »

I am trying out a script that will duplicate the selected XY zip file and rename it with newest beta number.

whats wrong with this script? especially the last part with rename. i thought i could add variables within the pattern.

::focus; #164; sortby created, d; sel 1; set $p, <focitem>; goto <xypath>|*.exe; sel 1; set $ver, <curver>; filter; goto $p; sel 1; rename bat, $ver, p

I end up with $ver.zip instead of the newest beta number.zip

I am a bit rusty today, surely missed something here. :?

admin
Site Admin
Posts: 66083
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Help with rename script

Post by admin »

Since a couple of days ago, the pattern argument in "rename" scripts does not support any variables anymore apart from those variables that are also allowed in the normal rename dialog (=date variables*). This was necessary in order to synchronize the scripting command "rename" with the other rename interfaces (Rename dialog and UDC).

Of course, I see the need for some adjustments here, and I kind of waited for the first poster to complain. :wink:

So what would be the ideal situation? I think (from the hip -- not meditation possible right now) all variables in the pattern argument should be resolved apart from the date variables before the pattern is passed oto the normal batch rename function. Okay?

* I just saw it's actually the date variables (individually resolved per renamed item) and <curfolder> and <curver> (both resolved once for all renamed items). :shock: This looks like outdated code to me and should probably be removed...

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Post by serendipity »

OR you can keep rename as it is now (as it is consistent with other guys) and provide a new command for handling renames with user defined variables.

admin
Site Admin
Posts: 66083
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

serendipity wrote:OR you can keep rename as it is now (as it is consistent with other guys) and provide a new command for handling renames with user defined variables.
Yep, for example rename2? Not so creative today... :wink:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Post by TheQwerty »

admin wrote:
serendipity wrote:OR you can keep rename as it is now (as it is consistent with other guys) and provide a new command for handling renames with user defined variables.
Yep, for example rename2? Not so creative today... :wink:
While I think it's a bit silly to really split things up like this, if that's the route you're going, make it a new argument not an entirely new command.

Or even a switch on the mode argmuent "/u" for user-vars.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Post by serendipity »

TheQwerty wrote:
admin wrote:
serendipity wrote:OR you can keep rename as it is now (as it is consistent with other guys) and provide a new command for handling renames with user defined variables.
Yep, for example rename2? Not so creative today... :wink:
While I think it's a bit silly to really split things up like this, if that's the route you're going, make it a new argument not an entirely new command.

Or even a switch on the mode argmuent "/u" for user-vars.
I agree, new command is not necessary in this case.

admin
Site Admin
Posts: 66083
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Help with rename script

Post by admin »

admin wrote:So what would be the ideal situation? I think (from the hip -- not meditation possible right now) all variables in the pattern argument should be resolved apart from the date variables before the pattern is passed oto the normal batch rename function. Okay?
I did it this way. No changes for you -- it just works now as expected in all situations. :)

BatchRename pattern
Processing of pattern argument in scripts:
- resolve user vars
- resolve environment vars
- pass to BatchRename function
- resolve native vars (excl. date vars)
- resolve date vars per item

Processing of pattern argument in UDC/BatchRename dialog:
- pass to BatchRename function
- resolve native vars (excl. date vars)
- resolve date vars per item


Your rename script should work now as expected.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Post by serendipity »

Thanks, I will check that out.

Update:

Checked it and works fine now. :D

I changed the script slightly to include hide folder setting and direct path to newly downloaded beta.

Code: Select all

::goto D:\softwares\XY\xyplorer_7.10_beta_noinstall.zip; focus; #164; sortby created, d; setting HideFoldersInList, 1; sel 1; set $p, <focitem>; goto <xypath>|*.exe; sel 1; set $ver, <curver>; filter; goto $p; sel 1; rename bat, XYplorerBeta_$ver, p
PS: I use wget method provided by user "fishgod" to update XY as described here.

Post Reply