Scripting Blog [archived]

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

How Can I Clear the Contents of Any File Dropped on My Script Icon?

(image) Hey, Scripting Guy! How can I write a script that will clear the contents of any file that I drag and drop on the script icon?-- SN(image) (image) (image) Hey, SN. Say, you didn’t by any chance misplace a few hundred thousand insects did you? OK; just thought we’d ask. This past weekend the Scripting Guy who writes this column ...

How Can I Make Sure That No Line in a Text File Exceeds 261 Characters?

(image) Hey, Scripting Guy! How can I make sure that no row in a text file exceeds 261 characters?-- RK(image) (image) (image) Hey, RK. You know, this was a good day to ask a question; for once the Scripting Guy who writes this column is in an OK mood. (No, he’s never in a good mood, at least not when he’s at work.) Yesterday the ...

How Can I Delete Just the Last Line of a Text File?

(image) Hey, Scripting Guy! How can I delete just the last line of a text file?-- AD(image) (image) (image) Hey, AD. You know, it’s been a long, hard day here at Microsoft, one of those days when everyone and everything seems to be against you. Many people, when faced with a day like today, turn to the so-called comfort foods: meatloaf, ...

How Can I Tell Which Numbers Are Missing From a Sequence of Numbers Found in a Text File?

(image) Hey, Scripting Guy! How can I look at a sequence of numbers in a text file and identify which numbers are missing from the sequence?-- TP(image) (image) (image) Hey, TP. Don’t you know that it’s Friday? This sounds like a tricky question to answer, and the Scripting Guys have an agreement with Microsoft that we don’t have to ...

How Can I Remove Double Double Quotes From a Text File?

(image) Hey, Scripting Guy! I have a comma-separated values file that has data similar to this: data1",""data2"","data3",""data4"". As you can see, some of the items are enclosed by two sets of double quote marks (like ""data2""). How can I remove one of those sets of double quote marks, leaving the item looking like this: “data2”?-- RH(...