Building a Console Application in VB for the Alibre Design API - Setting Up Command Line Flags E-mail
Article Index
Building a Console Application in VB for the Alibre Design API
Getting Started
Create a Visual Basic Project
Referencing the Alibre Design API
Importing Namespaces
Adding Comments
Setting Up Command Line Flags
Reading the Command Line Arguments
Redirecting the Standard Output
Hooking Alibre Design
Looping Through Sessions
Looping Through Configurations
Finishing Up
Resources
All Pages

Setting Up Command Line Flags

From the comment above, you can see that we're going to be looking for a couple of very specific command line flags to either enable or disable program functionality. We'll write a few lines to declare these flags as strings so we don't have to keep retyping them in the program.

    ' What arguments are we looking for?
    Dim outPathFlag As String = "-out:"
    Dim configurationFlag As String = "-conf"
    Dim countFlag As String = "-count"

Now that we'll be able to identify the command line arguments by these specific flags, we need to set up some variables that give meaning to the flags within our program. In the first case, we want to store the characters immediately following the "-out:" flag, if included on the command line, as the path and filename where we want to save the output of the program. We'll store it in a string called "outPath". In the next two cases, all the program really cares about is whether or not these flags were present on the command line. So, we'll set up a Boolean (a True/False value) and give it the default value of False. In the next section of code, we're change this to True if we came across the appropriate flag on the command line.

    ' This is where we'll store the arguments
    Dim outPath As String = ""
    Dim includeConfigurations As Boolean = False
    Dim includeCount As Boolean = False



Last Updated ( Monday, 28 January 2008 16:22 )