I just started playing with scripts in XY, and I hit a bit of confusion.
I'm basically trying to code a script that runs several RegEx renames. However, what I'm finding is that rather than acting on all the selected files, it only acts on the files that the very first regex matches.
Even if I add code to reselect every file in the folder in between every single RegEx Rename, it still only acts on the files matched by the very first RegEx.
Is this a bug, or did I make a mistake?
Problem with RegEx Renaming scripts
-
jacky
- XYwiki Master
- Posts: 3106
- Joined: 23 Aug 2005 22:25
- Location: France
- Contact:
Re: Problem with RegEx Renaming scripts
hmm... no the rename command should apply to all selected items. Of course, only those with names matching your regexp will be renamed, but since selection remains the same after renaming, there's no reason other rename operation don't apply to all selected items.
I do have scripts that do multiple (regexp) rename operations in a row, and they are applied to all selected items without trouble.
I do have scripts that do multiple (regexp) rename operations in a row, and they are applied to all selected items without trouble.
So you select all files, do a regexp rename, and yet only files matching a previous regexp are affected !?? Sounds really odd indeed... Does that happen whatever the regexp used ? Could you share a little script with only two or three calls to rename that work that way ?Mesh wrote:Even if I add code to reselect every file in the folder in between every single RegEx Rename, it still only acts on the files matched by the very first RegEx.
Proud XYplorer Fanatic
-
Mesh
- Posts: 956
- Joined: 24 Mar 2008 21:22
Re: Problem with RegEx Renaming scripts
I am happy for XY, but ashamed for myself, to say that this was a false alarm and the issue was caused by a coding error on my part.
In coding the script, I copied over RegEx's that I assembled in another text file which came from the manual renaming steps I had been using in XY. However, in the process of copying them over, a single line was missed which made all the difference.
My script syntax was fine, and the manual steps worked exactly as they should from top to bottom - so it appeared to be something else.
Please forgive me for bringing this up, and feel free to delete this thread.
In coding the script, I copied over RegEx's that I assembled in another text file which came from the manual renaming steps I had been using in XY. However, in the process of copying them over, a single line was missed which made all the difference.
My script syntax was fine, and the manual steps worked exactly as they should from top to bottom - so it appeared to be something else.
Please forgive me for bringing this up, and feel free to delete this thread.
-
admin
- Site Admin
- Posts: 66280
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Problem with RegEx Renaming scripts
I'll preserve it as a warning example.Mesh wrote:Please forgive me for bringing this up, and feel free to delete this thread.
FAQ | XY News RSS | XY X
-
Mesh
- Posts: 956
- Joined: 24 Mar 2008 21:22
Re: Problem with RegEx Renaming scripts
admin wrote:I'll preserve it as a warning example.Mesh wrote:
Please forgive me for bringing this up, and feel free to delete this thread.
Why do you hate me?
XYplorer Beta Club