Scripting Blog [archived]

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

How Can I Determine the Date for the Friday in a Given Week?

(image) Hey, Scripting Guy! Given a date, can a script tell me the date that the Friday for that week occurs?-- DLR(image) (image) (image) Hey, DLR. Too bad you didn’t ask which dates Saturdays, Sundays, and holidays fall on; coincidentally enough, each of the Scripting Guys have memorized - years in advance - all the days that we aren...

How Can I Compare Two String Values Regardless of Letter Case?

(image) Hey, Scripting Guy! I have a script that compares two email addresses and tells me whether or not they are the same. Sometimes the email addresses are the same, but the case is different: for example, one address might be example@abc.com and the other might be example@ABC.com. My script always tells me that these are different email ...

Hey, Scripting Guy! How Can I Retrieve the Value of an Active Directory Attribute that has a Hyphen in Its Name?

(image) Hey, Scripting Guy! We have a custom application that adds some attributes to the Active Directory schema. These attributes have hyphens in their names, and I can’t figure out how to retrieve the value of those attributes; any time I try to connect to one I get an error message. Any suggestions?-- TW (image) (image) Hey, TW. ...

How Can I Determine if a File Exists and, if It Does, Exit the Script?

(image) Hey, Scripting Guy! How can I check to see if a particular file exists and, if it does, exit the script?-- TO(image) (image) (image) Hey, TO. There are at least two ways to check for the existence of a file (that’s the real key here; exiting the script is easy). One of these approaches uses the FileSystemObject and the other uses...

How Can I Show Users a Dialog Box That Only Lets Them Select Folders?

(image) Hey, Scripting Guy! In previous columns you’ve shown us how to present users with a dialog box that enables them to select files. Is there any way to show them a dialog box that only lets users select folders?-- LP(image) (image) (image) Hey, LP. You know, you’ve come to the right place: the Scripting Guys have just what the ...