A-Team moment

It was brilliant I tell you, absolutely brilliant!  As Hannibal from The A-Team would say “I love it when a plan comes together”.  Only it wasn’t so much a plan as it was a stumbling upon things and having that sudden flash of insight that defies any real logical reasoning.  Let me give you a little background…

It was the spring of 1970 and love was in the air… oh, you don’t want that much background do you?  Ok, well, the background that is relevant to this story starts with a small Library at a small University with a bunch of students that panic when they open a Word Document from their email, work frantically for twelve hours straight, click save, close the Word Document, then open up the document from their email and are in utter shock and dismay when all of their work is simply gone.  Go ahead, laugh…

Done yet?

Well, it DOES happen, at least at this little University in this little library where our story takes place.  So, being the good little techies we are, we try to find a way to keep these poor students from just clicking save repeatedly while their document is saved to some random temporary storage location that gets overwritten the second they reopen the same document from their email.

Some would say it’s not our responsibility, these students are tech suave, they facebook, blog, IM and twitter all while maintaining a healthy social live, keep up with school and write papers for twelve hours straight…. Of course they know they should click “Save As” and make sure they KNOW where the document is saved.  Not to mention backing that document up to a secondary location, even if it is just the first 257 pages of a thesis.  So we broaden our shoulders and get ready to bear the burden.  I know, we can just remove the save feature from Word and force the students to use “save as”.  That would resolve the problem because then they would be forced to save it to some place meaningful, right?

Oh wait, there’s no way to remove the save button in Office 2007?  You can’t FORCE them to do a “save as”?  Blasphemy I tell you!  How will the world ever go on turning when these poor souls must fend for themselves!

Enter, stage left your average ordinary server goon — ok, really, far from ordinary or average, but really, it makes the story so much better if you have such low expectations to start with.  Seems there are some (57, not that I was counting) files that needed processing (just wait for it, this deviation does indeed have significance).  The processing was pretty straight forward, take an excel file, convert it to a tab delimited text file, take that text file do some heavy find and replace action to turn it into a nice clean HTML page.  Just another boring day in the live…

After the first five excel files, I started to feel a little miffed at the idea of having to open each excel file, clicking “save as”, selecting “tab delimited text file”, clicking ok, opening the next file…  You get the idea right?  It took about 20 minutes to process 57 files, not bad really.  Then I get the email “I’ve found some errors in the excel files and made some changes, hope it’s not a problem.”   AAAAARRRRGHHH! Ok, not a big deal, didn’t take that long….  I can do this… I’m getting quite quick at opening, saving as, etc…  Then I start processing the text files.  First file I start thinking this is really something I should automate (thinking in the back of my mind about the email).  So I bring up macros and figure out how to create a macro in Word (Oh give me a break, I don’t use word that often, and when I do it’s not for repetitive tasks, it’s to actually write something!).  Much better, now all I have to do is open each document, run the macro and then save the document.  Easy right?  Well, not easy enough for me.  I start thinking why should I have to open each document?  Why can’t I create a macro to open each document, run the script, save the document, close and move on to the next.  Which is exactly what I did.  And that is where the A-Team moment came in… (told you it had significance)

While looking at how to go through a directory listing and manipulate each file in that directory (or a file that meets a certain criteria, like, oh ending in .txt) I found a bit of a blurb that would display text based on a menu item action…  and the bulb clicked on…  Why not make a macro that would be triggered when someone clicked save?  It would be brilliant I tell you!  It would be easy enough to check the file path, see if it meets certain criteria and then make a simple decision based on that criteria…. either continue to save the document or highjack the process and force the unwitting participant to “save as”.

So I’ve passed on the idea to our very skilled programmer and I’ll post the results as they become available.  Right now I’ve got to go process some files…  It will take days I tell you days! But first, I’m going to get some sleep.

By Mark

I work in IT and ride Motorcycles. I do one to support the other.