I'm no programmer, so I'm posting this here in the hopes that someone will offer to code it...
What I need is a tool that takes a file as input, creates multiple copies, and outputs the copies with new filenames based on parameters that are entered.
This is what I'm trying to do - I have created three new robes for NWN. The filenames all start with pma0, pmd0, pme0, etc. - plus an additional group of female versions. I need to create copies for the other phenotypes (3, 6, 15-21, 30-33, 46).
For example:
1. I input the filename pma0_robe203
2. I key in the parameters (pma3, pma6, pma15, pma16, pma17, etc.)
3. The program outputs the new renamed files.
Utility Request - Or Maybe One Exists Already
Débuté par
Pstemarie
, juil. 27 2012 12:35
#1
Posté 27 juillet 2012 - 12:35
#2
Posté 27 juillet 2012 - 01:50
On a really, really simple level, as a windows batch file something like this would work:
Seemed to work in my testing anyways. I haven't actually scripted outside nwscript in more than a decade, so I'm quite rusty.
You'd also need to move the specific files into their own folder, since it's non-descriminant on what parts and part numbers would be copied. A couple more set variables could fix that though.
@set /p orig= Original Pheno:
@set /p new= New Pheno:
copy pma%orig%*.mdl pfh%new%*
copy pmd%orig%*.mdl pfh%new%*
copy pme%orig%*.mdl pfh%new%*
copy pmg%orig%*.mdl pfh%new%*
copy pmh%orig%*.mdl pfh%new%*
copy pmo%orig%*.mdl pfh%new%*
copy pfa%orig%*.mdl pfh%new%*
copy pfd%orig%*.mdl pfh%new%*
copy pfe%orig%*.mdl pfh%new%*
copy pfg%orig%*.mdl pfh%new%*
copy pfh%orig%*.mdl pfh%new%*
copy pfo%orig%*.mdl pfh%new%*
pause
Seemed to work in my testing anyways. I haven't actually scripted outside nwscript in more than a decade, so I'm quite rusty.
You'd also need to move the specific files into their own folder, since it's non-descriminant on what parts and part numbers would be copied. A couple more set variables could fix that though.
Modifié par Failed.Bard, 27 juillet 2012 - 01:50 .
#3
Posté 27 juillet 2012 - 02:58
Thanks, I modified it a bit so that I didn't have to key in the origin and new pheno every time. Now if I could just figure out why when you go from a single digit pheno to a double-digit pheno it chops the "r" off "robe" in the filename. I think its truncating the filenames so the new filename is the same length as the original filename.
This is just the block that handles one pheno. The full code has blocks for all the Q phenos
copy pma0_*.mdl pma15_* copy pmd0_*.mdl pmd15_* copy pme0_*.mdl pme15_* copy pmg0_*.mdl pmg15_* copy pmh0_*.mdl pmh15_* copy pmo0_*.mdl pmo15_* copy pfa0_*.mdl pfa15_* copy pfd0_*.mdl pfd15_* copy pfe0_*.mdl pfe15_* copy pfg0_*.mdl pfg15_* copy pfh0_*.mdl pfh15_* copy pfo0_*.mdl pfo15_* pause
This is just the block that handles one pheno. The full code has blocks for all the Q phenos
Modifié par Pstemarie, 27 juillet 2012 - 03:05 .
#4
Posté 29 juillet 2012 - 11:19
I think I used a utility called Fileboss to do this Pstmarie. Or Useful file utilities. Pretty sure both of them allow you to rename file and perform a text search and replace the filename inside the file with the new filename.
Useful file utilities lets you mask chars...
[N1-3]43[N5-]

So what that does is mask chars 1-3, and replace 4, then as I replaced it with a two digit number (0 replaced with 43), it's from char 5 to however many chars are left. It's more or less a RegEx editor.
Generally what I do is make a base copy of my original files in one directory... then rename the files with the renamer, and then do a batch replace (I'll attach the RTBL file as link) Batch file for replacing robe phenos
Useful file utilities lets you mask chars...
[N1-3]43[N5-]

So what that does is mask chars 1-3, and replace 4, then as I replaced it with a two digit number (0 replaced with 43), it's from char 5 to however many chars are left. It's more or less a RegEx editor.
Generally what I do is make a base copy of my original files in one directory... then rename the files with the renamer, and then do a batch replace (I'll attach the RTBL file as link) Batch file for replacing robe phenos
Modifié par Calvinthesneak, 30 juillet 2012 - 12:13 .





Retour en haut







