Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Import a Fixed-Width Data File into Microsoft Excel?

(image) Hey, Scripting Guy! How can I import a fixed-width data file into Microsoft Excel?-- RS(image) (image) (image) Hey, RS. This column is being written on a Friday morning, and so far it’s been a very weird morning at that. For one thing, it’s not raining and – if you look closely – you can even see the sun. (It’s been ...

Hey, Scripting Guy! How Can I Conditionally Add Lines to a Text File?

(image) Hey, Scripting Guy! I need a script that can read a file and, based on the contents, insert some additional lines of text into that file. Can you help me with that?-- JS(image) (image) (image) Hey, JS. We’re sure that most of you have heard by now that Microsoft has made an offer to buy Yahoo!, an offer currently valued at around...

Hey, Scripting Guy! How Can I Use Data Read From a Text File as Command-Line Parameters For a Batch File?

(image) Hey, Scripting Guy! I'm trying to automate a tedious license server task. To do this, I need to loop through a text file line-by-line, grab out a user name, asset number, and license ID, and then pass those values to a batch file. How can I do all that?-- DM(image) (image) (image) Hey, DM. Before we get started today is Friday, ...

Hey, Scripting Guy! How Can I Write a Message to All the Empty Files in a Folder?

(image) Hey, Scripting Guy! I need to search a certain directory for files with a size of 0 KB, then replace the non-existent text in those files with an error message like this one: "File did not save correctly." I have been searching for the answer myself and can't seem to grasp it. Can you help me on this one?-- CE(image) (image) (image...

Hey, Scripting Guy! How Can I Remove Extraneous Spaces From Fields in a Text File?

(image) Hey, Scripting Guy! I have a text file in which each field has a bunch of extra spaces tacked on to the end. How can I remove all those extra spaces?-- GC(image) (image) (image) Hey, GC. Well, today is Monday, February 11th, which can mean only one thing: the 2008 Winter Scripting Games are just a few days away. But we didn’t ...