BookCase - The Ultimate eBook Renamer

BookCase (v6.7) - The Ultimate eBook File Renamer on Crack

BookCase is a heavily modified TitleCase Plus so some credit should go to the developers of both TitleCase and TitleCase Plus and any others that had a hand in some of the scripts in here, with many thanks to LEO & MrC for answering and helping me with a number of my questions. I'm not a pro-coder so i'm sure some of the stuff I have done in the code can be streamlined so feel free to give input or post in here some refinement to my code. Hope you enjoy. Cheers!

BookCase Does the Following:

All these are set as options that can be turned on or off by changing the value to "True" or "False" in the options area of the code. It is clearly marked if you edit the button.

Just an example of what it can do:

What format do you prefer?

format

Just edit the bookcase button and set the options to your preference:

Included in the zip is BookCase the file as a button. Also Including in the zip are three other eBook Renaming buttons and two menus containing even more book renaming bottoms.

Buttons and BookCase placed on the Bar:

buttonbar

Contained in the zip are:

  1. Button: BookCase - The main rename button/script, with all the settings and features shown above.

  2. Button: Trim - trims multiple spaces, leading and trailing

  3. Menu: Replaces
    replaces

    • Replaces underscores with a comma
    • Replaces underscores with spaces
    • Replace file name with folder name
    • Replace by with a dash
    • Append folder author name to beginning of file name + a dash separator
    • Removes everything but authors name on folders
    • Add series brackets
    • Remove desired # of charters from beginning of file name
    • Remove desired # of character from end of file name
    • Add extension info in brackets to end of file name
    • Dots to spaces except in numbers
    • Separate pushed together initials
    • Add dots to initials
    • Zero pad single digit numbers in series
    • Add "Series" to series that have just numbers and no series name.
    • Strip series out of file name
    • Remove a desired text
    • Insert a desired text
  4. Menu: Swaps
    swaps

    • Swaps lastname, firstnames of any type also multiples of them separated by & or and.
    • Swaps everything in a title on either side of a comma.
    • Swaps everything in a title on either side of a comma except brackets.
    • Swaps library order to regular title order excludes sentences that are not library order
    • Replace by with dash then do a author title swap
    • Replace underscore with a comma and do a Ln, Fn swap.
    • Swaps title series author (TSA) to (AST) and leaves bracketed info in place
    • Swaps (TAS) to (AST) and leaves bracketed info in place
    • Swaps (SAT) to (AST) and leaves bracketed info in place
    • Swaps (STA) to (AST) and leaves bracketed info in place
    • Swaps (ATS) to (AST) and leaves bracketed info in place
  5. Button: File to Folder - creates a author name folder from selected file

  6. Button: Advance Rename: Goes to the advanced renaming window (like the default toolbar button).

Let me know what you think when you test drive them!

Download:

  • Download and unpack: BookCase_(v6.7)a.zip (25.5 KB)
  • In Opus, select Settings > Customize Toolbars.
  • Drag any of the .dcf files you extracted from the zip to where you want them on your toolbars.
  • Click OK in the Customize dialog.

Old Download:

  • The download above has been modified to make it easier to import, and fix a character-encoding issue. The original version of the download is kept here, just in case it is needed in the future. Most people should use the newer zip file, above, instead of this.
    BookCase_(v6.7)a.rar (19.9 KB)

Note on Typical Settings:

  1. Keep all bracketed information regardless of what it is:
    fBracketMagic1 and fBracketMagic2 should be False

  2. Remove all bracketed info accept version info and series if bracketed:
    fBracketMagic1 = True and fBracketmMagic2 = False

  3. Remove all Bracketed info but keep series info if bracketed:
    fBracketMagic1 = False and fBracketMagic2 = True

The way the script is written, it's likely to run quite slowly when lots of files are being renamed.

e.g. Each filename is passed through about 1000 search & replace operations, most of which could be replaced by a few simple lines of code. It looks like you've learned how to use the Replace function in VBScript and tried to solve every problem with it. I recommend reading some tutorials on VBScript to get a better understanding of what it can do, if you plan to spend more time with rename scripts (or scripts in general). You'll find it rewarding if you do.

There's also some rather esoteric stuff in the script which I'm not sure many other people will find useful, especially the "fCapMagic3" part where you've listed particular initials and acronyms.

Just as an example: your fCapMagic2 section, which removes the space between two initials (e.g. "A A " -> "AA ") contains one Replace function for every single combination of two letter initials (in the Roman alphabet). That's 676 lines (26*26)! You could rewrite this using a loop something like this:

Dim i for i = 1 to Len(strNewName) - 4 if Asc(Mid(strNewName, i, 1)) >= 65 and Asc(Mid(strNewName, i, 1)) <= 90 then if Mid(strNewName, i + 1, 1) = " " then if Asc(Mid(strNewName, i + 2, 1)) >= 65 And Asc(Mid(strNewName, i + 2, 1)) <= 90 then if Mid(strNewName, i + 3, 1) = " " then strNewName = Left(strNewName, i) & Right(strNewName, Len(strNewName) - i - 1) i = i + 2 end if end if end if end if next

Thanks for the input... yeah i had to go at some of the things i needed to do like a red headed step child because i couldn't figure out a more streamlined way of doing it. As far as how long it takes... i ran it against 20,000 files and it took 2min and 32sec. That beats weeks of doing it by hand. By sharing it on this forum I was hoping to accomplish 2 things... #1 provide a useful renaming tool to avid ebook collectors like myself thats consolidated into one script rather than having to run multiple different scripts in several renaming apps and #2 receive feedback and streamlining suggestions from more experienced scripters than myself :wink: but what can you say i have only been playing around with vbscript for 4 days.

CapMagic3 was made to clean up any two letter words that got capped as initials... I guess I didn't need to make it a choice it needs to run till there's better code in place.

I plan to keep learning its pretty fun there are a lot of things i still want to do to improve this script and i have an idea for a few new ones...so thanks again LEO.

See I knew it would pay off posting in here.. I'm gonna test the code you wrote now Jon..thank you. I was sure it could be done a more streamlined way. Cheers!

... and even that loop, using the right tool, is simpler written as:

s/\b([a-z])\b\s+\b([a-z])\b/\u\1\u\2/

SO, from 676 lines, reduced to 13, further simplified to 1simple line with 37 chars. :slight_smile:

I tried the code out It works very good thank you... Now I just need to figure out how to replace CapMagic1

I tried sticking this regex into a couple different renamers.. can't get it to work..whats it suppose to work in?

I also put it into regex buddy which returned Unknown regex token \u. Use backslashes to escape metacharacters....

Thread updated from (v5.8) to (v6.7) above with many requested features from the MobileRead community added in

Just found this tool. Wow! This is going to save me a lot of time and effort. Thanks!

Hope it works out for you :slight_smile:

One quick item that I'd love to see added (or, if it's there, I've somehow missed it): Lots of books that I have are in the format Title - Author. I'd like a quick way to change the books to Author - Title.

its there "Swap T,S,A not ()" it will swap the title and the author and leave the series in place or if its not there it will still do the swap...any bracketed info will remain in the same place at the end of the file name. t=title s=series and a=author.

OK. Thanks. I didn't realize that would work if the file wasn't formatted as described (i.e, no series).