Jump to content

[Resolved,Non-AI]FileMove isn't renaming files ... (??)


Recommended Posts

I've scanned through a ton of FileMove messages in the forum since yesterday but can't seem to find why FileMove isn't renaming files properly.

I've upgraded to latest AutoIt but still not getting desired resuslts. I'm hoping it's just something silly I'm doing that I don't know about <g>.

The code is this:

FileMove(@ScriptDir & "\*_*.mp3", @ScriptDir & "\* *.mp3", 1)
FileMove(@ScriptDir & "\*[1]*.mp3", @ScriptDir & "\*.mp3", 1)

About the only thing that happens is that the mp3 extension gets a new space before it every time I run the script.

Even when run individually or with sleep in between the commands, nothing happens except that space appears.

The goal is to have this type of filename:

mercury_theater_380829_the_count_of_monte_cristo[1].mp3
renamed to this via this AI script:
Mercury Theater 380829 The Count of Monte Cristo.mp3

When I tested this by actually having the files moved into a new directory by adding a folder to the destination, the files got moved without renaming there, too. I've tried without and without the overwrite flag ("1") but still nothing. Only discernible difference is I get an extra space between filename and extension whenever I invoke the script.

What am I doing wrong, anyone know?

Thx. :x

p.s., have various renaming apps but want to do this via a script so that I have full control. The relative path power of AutoIt can't be beat and all those renaming apps just don't cut it for this purpose.

Edited by Diana (Cda)
Link to comment
Share on other sites

Hi,

From Help file (FileFindFirstFile entry)

Wildcards: In general, * denotes zero or more characters, and ? denotes zero or one character. If your file search string contains only wildcards (or is "*.*"), then see the example below for the return value!

You can use only one wildcard in the filename part or in the extension part i.e. a*.b?.

?? seems equivalent to * (not described in Microsoft documentation).

When using a 3-char extension any extension starting with those 3 chars will match, .e.g. "*.log" will match "test.log_1". (not described either in Microsoft documentation).

Link to comment
Share on other sites

Hi, thanks for your response; very quick, too!! <g>

Wildcards: In general, * denotes zero or more characters, and ? denotes zero or one character. If your file search string contains only wildcards (or is "*.*"), then see the example below for the return value!

You can use only one wildcard in the filename part or in the extension part i.e. a*.b?.

?? seems equivalent to * (not described in Microsoft documentation).

When using a 3-char extension any extension starting with those 3 chars will match, .e.g. "*.log" will match "test.log_1". (not described either in Microsoft documentation).

Ah, so that's where the trouble lies. It didn't occur to me. Well, I tried using ?? in place of each asterisk above, as the implication above states that that might be best other than asterisk, but that didn't work either. Because the things to be changed lie within the filename itself and can't be signalled by a single asterisk, can't do it just by using one. All the underscores happen between the word components of the filename.

Any suggestions (besides going with a third party renamer)?

Thanks. :x

Edited by Diana (Cda)
Link to comment
Share on other sites

You can write your own, it doesn't have to be third party. You will never get Windows to rename your files with the complex changes you're looking for.

Now that's just silly. AutoIt is so powerful, surely there's a solution somewhere ... it's just finding it, of course ... <g>

However, on to your recommendation, I have a hard enough time writing in AutoIt never mind learning a full programming language. <sheesh>

Well, I won't give up. Somewhere, somehow, there has to be a way. I refuse to believe that AutoIt can't do it.

And as for third party apps, tried a bunch again last night. The reason why they aren't good enough is that few save settings. Those that do don't translate well to working in any directory. RenameMaster seemed to be ideal but watch if you switch directories, it doesn't keep the settings very well (in fact, it does a pi**-poor job of things if you use same settings for more than one directory -- and what's the point otherwise??!!). Rename-It!? Well, it works the best so far but it requires several keystrokes before it gets going _and_ remembering what the extra settings are each time you use it that don't get saved in the presets file. No good.

Well, I've been a member here long enough to know that despite one person saying it can't be done, some time down the road someone sometimes provides an easy answer that goes contrary to that, so I'm not giving up. I've lived with doing this manually for many months now with a renaming 3rd party - hopefully an AI solution is somewhere soon down the road.

Thanks just the same. :x

Edited by Diana (Cda)
Link to comment
Share on other sites

if they are all that pattern (replacing underscores with spaces and removing any bracketed numbers) then maybe just loop through all the names and do the following:

$string = "mercury_theater_380829_the_count_of_monte_cristo[1].mp3"

$replace = StringRegExpReplace ($string , "_" , " ")

$replace1 = StringRegExpReplace ($replace , "\[\d\]" , "")

msgbox (0 , '' , $replace1)

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Diana,

While not complicated, this task is not as trivial as you seem to think...the problem is not a limitation of AutoIT, but of Windoze.

Here's how I would do it:

spin through the files using a "filefindfirst/filefindnext" loop

for each file in the loop

split the filename on the "_" char ("stringsplit")

create a new, empty file using the array elements from the previous split to construct the filename

copy the old file to the new file (filecopy)

Happy 2011!!

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Diana,

While not complicated, this task is not as trivial as you seem to think...the problem is not a limitation of AutoIT, but of Windoze.

<lol> No, not trivial, but I've enough experience to know that some creativity might get around those limitations. Whenever someone says it can't be done (either in Window$ or in AI), I know enough that someone else, thinking outside the box, might have a means to. Yeah, Window$ can be pretty stupid! But here it looks like there might be a way, so that's all I meant.

Here's how I would do it:

spin through the files using a "filefindfirst/filefindnext" loop

for each file in the loop

split the filename on the "_" char ("stringsplit")

create a new, empty file using the array elements from the previous split to construct the filename

copy the old file to the new file (filecopy)

Happy 2011!!

kylomas

Thanks. I'll take a look at this. It's something new for me and so I see some time ahead trying to work this out. Arrays and string splits are rough ground. I've managed to do _some_ string splits work but arrays are still beyond me. But then, at one time messages boxes were. And then a couple of years later, GUIs were. Msgboxes soon were a snap and the GUI threshold I painstakenly crossed some time back so that I now manage more or less on my own with them. I'll eventually cross the arrays threshold, too.

Thanks. :x

Link to comment
Share on other sites

  • 1 month later...

Thanks everyone. I see that I didn't come back close this issue since a lot of time went by before I found a solution.

This one was beyond me at this stage. It was just too complicated without seeing an example. Fortunately, after yet another search through renaming utilities, I found one that finally was easy enough to work with and it did the job. It's a freeware called Rename-It! whose search and replace filters are actually easy to use (amazing!). Most aren't. This is the first renaming app of its particular kind that I can say that about.

But thanks. I shelved this one to come back to at a later date. I may be progressing slowly with AI but have no doubts now that some time down the road I'll understand better what to do.

Cheers,

:)

Edited by Diana (Cda)
Link to comment
Share on other sites

Hi Diana. :)

The renaming of your mp3 files seems not to be based on anything solid. You may want to change the filenames but what if you change your mind and want some other naming scheme? You are not renaming by ID3 tag so you rename off of, hmm, I do not know what. My mp3s are all tagged correct with covers added to resources, named by the ID3 tags, have playlists created and can be renamed rather quick with a program like Mp3tag very easy as it has variable/script support for handling your audio files.

IIRC, that lazycat made a ID3 UDF (possibly with using a custom DLL) to read ID3 tags from AutoIt. So if you get your ID3 tags in order then renaming is a simple task. Just like a good AutoIt script can work for you over and over again, so can good ID3 tags for your audio files when it comes to renaming. So put the effort into the ID3 tags and the rest will solve itself programmically with Mp3tag or even if you want to create an AutoIt script to do it.

Link to comment
Share on other sites

Hi Diana. :)

The renaming of your mp3 files seems not to be based on anything solid. You may want to change the filenames but what if you change your mind and want some other naming scheme?

Hi, thanks for your comments.

I would agree with you if this were an actual MP3 file renaming issue. However, it isn't. It's a _file_ renaming issue that just happens to deal with MP3s. I merely mentioned the file format because that's what I'm working with.

This is one of the few times I need to add the time/date creation stamp information to a file rename process. I use ScreamerRadio, a freeware streaming radio app, to listen to the news. It records any session with the simple push of a button. There is no need for renaming as per ID3 info because these are not music files. I merely need to know the date and time recorded and best way is to have that in the file name, I've found.

I found a very cumbersome workaround. Date and file stamp components in renamers often don't accept custom formats. But I finally found a freeware called Métamorphose that more or less renames close to what I need. A bit of tweaking in various ways and I get the end result needed. Again, not ideal since AI would give me a targetted end result immediatley, but I know my limitations and I have to work with the knowledge I currently have. When I'm more advanced, will one day be able to write the script to do this all in one. But will live with this new process using 3rd party apps which is a helluva a lot better than the manual renaming process I've been doing for the last 3 years! <g>

Thanks.

Edited by Diana (Cda)
Link to comment
Share on other sites

p.s., very OT, but for true MP3 renaming needs, found the best app to do this recently after trying a few dozen over the last decade. It's freeware to boot! It's called MP3 Book Helper and it's easy as pie to work with. It supports drag 'n drop, ID3 renaming is a snap and the options are pretty incredible. Once I found how to save the "presets", it became practically perfect. For current renaming need, didn't find any way to add the creation date and time, though, but it works for all my other normal MP3 renaming needs.

Saving the presets took some doing as it's not readily apparent at outset, but see 3rd point below. Using the app goes basically like this:

- You have to load/drag in MP3s before all options become usable (meh, too bad, but sometimes we have to live with things)

- Tick "2&1" radio button under TAGS tab so that you get ID3 v2, as well

- then save or load presets via not very intuitive: TAGS > MASK PRESETS FOR ALL FIELDS > make your choice here to save or load

Cheers!

:)

Edited by Diana (Cda)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...