Regular Expression Renaming Script Files....
Regular Expression Renaming Script Files....
Backstory
Well, a while back I had this idea to write a small script that would run alongside XY and could be called from the Regular Expression renaming dialog to insert some complex patterns. My intent was to write something that might be useful for beginners, so they could use the power of regular expressions without pulling out all of their hair trying to write the patterns.
I almost finished it, but wanted to add some methods for prompting the user to input the values for some variables, and then lost interest. Needless to say it never got done.
Then Don introduced scripting, and with script files there was a solution very close to what I had coded. Now that he's added a way to get user input, it's way better than what I had accomplished.
The point...
I've converted the regular expression patterns I had previously written into XY script file format and have decided to share that with all of you.
These patterns cover the major functionality in a renaming program I use to use before XY, and while there are other ways to achieve plenty of this in XY already, I thought the patterns might be helpful to those trying to learn. (Writing them taught me more than I had expected.)
What follows are the contents of 4 files which I've placed in a directory within my XYplorer directory (".\Scripts"). You can place them elsewhere but you'd need to change the loadScriptFile commands to the new paths.
The first script just calls the other ones and makes the menu function like it has submenus. The other three contain a number of patterns for renaming just the filename, just the extension, or both.
To execute, ensure scripting is turned on, and then run the script "::loadScriptFile Scripts\RegExp-Rename.xys"
Hopefully, this works out okay with copying and pasting from the forums.
NOTE: As scripting is still a work in progress and the syntax and format may change these files may become obsolete. I will try to stay on top of that but I make no promises.
Also, xys, is not an official XY script file extension (at least not at the time of posting). It's just something I'm using to keep things sorted locally.
UPDATE: These scripts have been moved to http://www.xyplorer.com/xyfc/viewtopic. ... 0825#20825
Well, a while back I had this idea to write a small script that would run alongside XY and could be called from the Regular Expression renaming dialog to insert some complex patterns. My intent was to write something that might be useful for beginners, so they could use the power of regular expressions without pulling out all of their hair trying to write the patterns.
I almost finished it, but wanted to add some methods for prompting the user to input the values for some variables, and then lost interest. Needless to say it never got done.
Then Don introduced scripting, and with script files there was a solution very close to what I had coded. Now that he's added a way to get user input, it's way better than what I had accomplished.
The point...
I've converted the regular expression patterns I had previously written into XY script file format and have decided to share that with all of you.
These patterns cover the major functionality in a renaming program I use to use before XY, and while there are other ways to achieve plenty of this in XY already, I thought the patterns might be helpful to those trying to learn. (Writing them taught me more than I had expected.)
What follows are the contents of 4 files which I've placed in a directory within my XYplorer directory (".\Scripts"). You can place them elsewhere but you'd need to change the loadScriptFile commands to the new paths.
The first script just calls the other ones and makes the menu function like it has submenus. The other three contain a number of patterns for renaming just the filename, just the extension, or both.
To execute, ensure scripting is turned on, and then run the script "::loadScriptFile Scripts\RegExp-Rename.xys"
Hopefully, this works out okay with copying and pasting from the forums.
NOTE: As scripting is still a work in progress and the syntax and format may change these files may become obsolete. I will try to stay on top of that but I make no promises.
Also, xys, is not an official XY script file extension (at least not at the time of posting). It's just something I'm using to keep things sorted locally.
UPDATE: These scripts have been moved to http://www.xyplorer.com/xyfc/viewtopic. ... 0825#20825
Last edited by TheQwerty on 03 Apr 2008 13:29, edited 3 times in total.
-
admin
- Site Admin
- Posts: 64880
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expression Renaming Script Files....
I had already felt the likely emergence of a new job profile: XY Script File Writer. You are the first!
I did not test it yet but it sure looks like something I'd rather have anybody do but me.
Thanks!
FAQ | XY News RSS | XY X
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
I'm just still starting to digest the above coding, but it would appear to me that this has to be one of the MOST impressive posts that I've seen here for a long time! 
That must have taken a fair amount of time to do and wanted to say that it was appreciated!!
Pretty soon, at this rate, XY scripts will become another language just like TCL, Perl, etc!
That must have taken a fair amount of time to do and wanted to say that it was appreciated!!
Pretty soon, at this rate, XY scripts will become another language just like TCL, Perl, etc!
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
WOW!!!
. Those are amazing scripts for me. I tried them right now and they work like charm.
Its amazing to see how fast XY is evolving and how much one can do with this app. Kudos to Don ofcourse and TheQwerty for sharing his scripts.
I think there should be a separate thread or section only for scripts, because i can see they will drown other posts and might scare newbies.
Again, thanks for scripting and scripts.
Its amazing to see how fast XY is evolving and how much one can do with this app. Kudos to Don ofcourse and TheQwerty for sharing his scripts.
I think there should be a separate thread or section only for scripts, because i can see they will drown other posts and might scare newbies.
Again, thanks for scripting and scripts.
-
admin
- Site Admin
- Posts: 64880
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Indeed, some things got garbled during transmission, plus there's a curious mistake in all of the above UserInput scripts: the Caption is at the wrong argument position (pos 3 instead of 2).
Here's a corrected and tested version of the third XYS, which works great now!
http://www.xyplorer.com/download/RegExp-Both.xys
Thanks again, TheQwerty!
PS: I just noted that IE will open and display XYS files without asking!
So it knows the extension??
Here's a corrected and tested version of the third XYS, which works great now!
http://www.xyplorer.com/download/RegExp-Both.xys
Thanks again, TheQwerty!
PS: I just noted that IE will open and display XYS files without asking!
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 64880
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Really? Without changing? As I said in my other post the UserInput syntax was wrong. Or maybe my browser is defect...serendipity wrote:WOW!!!. Those are amazing scripts for me. I tried them right now and they work like charm.
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 64880
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
But you saw the "caption" in the input field instead of above it? Or am I going crazy?Pagat wrote:The original scripts (at least the extension only script) worked for me too...
FAQ | XY News RSS | XY X
The original's should work.. they just prompt differently.
They show the prompt in the text field instead of in the actual prompt space.
I should correct that.
I think I tried it the first time with those values in the correct place but I didn't have the spaces right after the commas so it didn't work.
Then when i realized why things weren't working I never went back to change those.
/me goes back to edit.
EDIT: All fixed. Also, thanks everyone! Glad it's being enjoyed!
The script itself wasn't bad, but it did take me a while to do the patterns back when I did them.
They show the prompt in the text field instead of in the actual prompt space.
I should correct that.
I think I tried it the first time with those values in the correct place but I didn't have the spaces right after the commas so it didn't work.
Then when i realized why things weren't working I never went back to change those.
/me goes back to edit.
EDIT: All fixed. Also, thanks everyone! Glad it's being enjoyed!
The script itself wasn't bad, but it did take me a while to do the patterns back when I did them.
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Well, as far as i can remember the captions were shown properly. But after your post i noticed an extra comma before the caption and removed them. But having that extra comma made no diference to me.admin wrote:Really? Without changing? As I said in my other post the UserInput syntax was wrong. Or maybe my browser is defect...serendipity wrote:WOW!!!. Those are amazing scripts for me. I tried them right now and they work like charm.
Also, the separators were not shown properly, apparently, there was an extra space between p and - which i removed and separators look fine now.
-
admin
- Site Admin
- Posts: 64880
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Yep, the extra spaces are added when copying from the browser, I think. I will make the separator recognition a bit more tolerant...serendipity wrote:Also, the separators were not shown properly, apparently, there was an extra space between p and - which i removed and separators look fine now.
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 64880
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Cool, thanks. Wait with any other fixing till tomorrow. I'm having a flow and new ideas are coming in like mad...TheQwerty wrote:EDIT: All fixed. Also, thanks everyone! Glad it's being enjoyed!
The script itself wasn't bad, but it did take me a while to do the patterns back when I did them.
FAQ | XY News RSS | XY X
I had feared something like that would happen. (But of course not enough to actually test it after the fact.admin wrote:Yep, the extra spaces are added when copying from the browser, I think. I will make the separator recognition a bit more tolerant...serendipity wrote:Also, the separators were not shown properly, apparently, there was an extra space between p and - which i removed and separators look fine now.
Oh, I was counting on you breaking everything on me.admin wrote:Cool, thanks. Wait with any other fixing till tomorrow. I'm having a flow and new ideas are coming in like mad...
/me gets excited for all the new unseen ideas.
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
I just took a look at the phpBB site and see that attachments are available in vers 3 of the forum software, but for now, I think we'd maybe just want to make one or a few stand-alone threads in this sub-forum to hold these (or pointers to download locations), and they could be marked as "sticky"'s...TheQwerty wrote:Maybe we need an attachment mod for phpBB so that instead of inlining scripts we could just attach them.
The advantage would be that they could be updated as needed should coding need to be changed, where attachments seem to be more fixed in contents...and they could also be then stored on XY site as downloads for ease in retrieval, if desired, as Don seems to have already done for one.
I could see a set of these being included in XY package, similar to TOTD, and/or a page on XY site listing available scripts for download.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
XYplorer Beta Club