Snippets to Go

In this month’s column, learn how to use the IIf function and the GetToken function in your VBScript code.

Readers

April 10, 2005

2 Min Read
ITPro Today logo in a gray background | ITPro Today

Do you ever get so busy that you forget to eat lunch or hold off going to the restroom until the last possible minute? Do you ever get so involved in your work that hours slip by in what seems like only minutes? If you're a systems or network administrator, engineer, or architect, you probably answered yes to these questions. In a world where companies are trying to do more with less to stay competitive, long to-do lists are the norm rather than the exception for IT staff.

Automating tasks with scripts is a proven way to save IT staff a lot of time, especially when the tasks are tedious and must be performed regularly. However, writing the script can be time-consuming. To help reduce the up-front investment of time, Windows Scripting Solutions is starting the new Snippets to Go column. This column will present functions, subroutines, and other blocks of code that you can drop into your scripts every time you need to perform a certain operation or procedure. The code in these reusable snippets requires little or no modification, so you'll save time because you don't have to reinvent the wheel each time you write a script.

If you have snippets you'd like to share, we encourage you to tell us about them. The snippets can be in any scripting language. They should perform a specific operation or procedure and be easily dropped into or called from scripts. Email your snippet and a description (500 words or less) of what it does and how to use it in a script to [email protected]. If we print your submission, you'll get $100.

This month, we offer the IIf and GetToken functions. The IIf function evaluates an expression and returns a specific value, depending on whether the expression evaluates to True or False. The GetToken function parses a line of text for a specific token, using the specified delimiter. To read about these functions, click the appropriate Side Bar link above.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like