DonationCoder.com Software > Post New Requests Here
IDEA - a simple way to batch rearrange blocks of text within filenames
jovejupiter:
Hi Skrommel,
I created 15 text files, all identical except for their names which ran from series-date-001-episode.txt to series-date-015-episode.txt
As a test I wanted to reverse the order of the parts, so I set the relevant part of the input ahk file to
separator =- ;Char(s) separating the parts of the input filename, use <space> for space
oneseparator=1 ;0=No 1=Yes Treat the separator as one unit?
outpattern =<4>-<3>-<2>-<1> ;Pattern of the output filename
inpattern =<1>-<2>-<3>-<4> ;Pattern of the input filename, not in use, just to explain!
If I understand the code correctly, that should take files of the form A-B-C-D.* and convert them to D-C-B-A.*
As I'm not completely familiar with AutoHotkey yet, I converted the script to an exe file using Ahk2Exe.exe and placed it on my desktop.
Then I dragged the 15 files to the desktop icon.
Files number 004 to 115 were converted correctly but files number 001 to 003 were unchanged.
I then dragged the 3 remaining files to the desktop icon and file 003 was converted.
Dragging files 001 and 002 to the icon converted file 002
Finally dragging file 001 to the icon converted it.
Is there something I've misunderstood about how to set up the input parameters or is there a problem with the code?
Cheers
Tony
skrommel:
:tellme: Hmmm.... Is this a problem with the topmost script, too?
Skrommel
jovejupiter:
Hi again Skrommel,
I converted the original script to an exe without any modifications and dragged the 15 files to the desktop icon.
All 15 file names were changed, with the format:
series-date-001-episode.txt to test-series-date-001-episode.txt
The input part of the script reads:
separator =-<space> ;Char(s) separating the parts of the input filename, use <space> for space
oneseparator=1 ;0=No 1=Yes Treat the separator as one unit?
outpattern =<4><2>test<2>-<1> ;Pattern of the output filename
inpattern =<1>- <2>- <3>- <4> ;Pattern of the input filename, not in use, just to explain!
If I'm reading the code correctly I would expect this to do nothing to the files in this case as the separator is - and not -<space>
If it accepted the spacer it should end up with file names of the form:
episode-datetestdate-series.
Regards
Tony
skrommel:
:) The topmost script does not handle <space>, and it also handles the separator chars individually. I just need to know if there's bug in the renaming or the dragging and dropping.
Skrommel
jovejupiter:
Hi Skrommel,
The original script renames all of the files in the same way (none are missed out) but the sequence of the parts in the new file names is incorrect.
Changing the input parameters results in the rename working correctly for some files but some are left unchanged.
Cheers
Tony
Navigation
[0] Message Index
[*] Previous page
Go to full version