Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Renamer script...

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,45152
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Renamer script...
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Renamer script... - 3/28/2007 8:23:01 PM   
  markmcrobie

 

Posts: 314
Score: 0
Joined: 12/12/2006
Status: offline
...will be pretty useless to most people, as it's designed with a very specific task in mind that won't apply to most, but it's taken me months to get it to this stage, and I'd never used any kind of programming code before, so I'm pretty proud of it - thanks to all who helped with it on these forums.

Background:

We have to export documents from our Hummingbird Document Management System and transfer them to a PC that's on another network.  The problem is Hummingbird exports them using it's own internal numbers/data in the format:

<library name>-#<internal doc number>-<library version>-Name_of_file_with_underscores_for_spaces

For example:

BERTHING_U-#12345-v1-Nuclear_Safety_Broadcast_System_Design.PDF

Which I'm sure you'll agree is pretty unreadable, especially if you have lots of files like this.  Also we need to have 3 other fields from within Hummingbird in the new file name, but Hummingbird won't let you choose which field names to export as part of the name.

So before my script came into existence, we had to manually rename each file, removing the BERTHING_U-#12345-v1- bit, find the other 3 fields values for that file by looking in Hummingbied, append them to the start of the file name, and remove all underscores.  Remember this was done manually, within Windows Explorer.  And we can do hundreds of files at a time.

So my script started as a 6 liner, trying to automate this labourious task a bit.  It grew & grew, it's now 243 lines!  In summary, here's what it does:

1) Offer the user to pick a folder where the candidate files for renaming are

2) Set some Regular Expressions to find the text, etc, I want to get rid of

3) Loop through all the files in the chosen folder, finding any candidates for renaming

4) Offer the user the chance to type in the info from the extra 3 fields

5) Rename the files

6) Once done offer the user the chance to e-mail them or queue them to burn to CD (depending on size)

It works very well.  As I said I don't think as a whole that many people will have a use for it, but it's pretty well commented and someone somewhere might find a use for a technique used in it or a section of it

For the sake of easier reading, I'll post it in a separate post.
 
 
Post #: 1
 
 RE: Renamer script... - 3/28/2007 8:23:27 PM   
  markmcrobie

 

Posts: 314
Score: 0
Joined: 12/12/2006
Status: offline

      

(in reply to markmcrobie)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Renamer script... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts