home *** CD-ROM | disk | FTP | other *** search
- **************************************************************************
- * *
- * This script demonstrates how to write a "dial by name" command. *
- * You can attach this script to a definable key using <ALT>K *
- * by entering this as the definition of that key: *
- * *
- * @G@/NAMEDIAL^M/ *
- * *
- * This allows you to dial systems by name rather than entry number *
- * simply hitting the defined key. *
- * *
- **************************************************************************
- *
- * Holds name of system to dial
- Declare Name String
- * Holds one directory entry
- Declare DirEnt String
- * Number of dialing directory entries
- Declare NEntries Integer
- * Number of dialing directory entries (string)
- Declare SEntries String
- * Current entry number
- Declare IEntry Integer
- * Flag telling if we find emtry
- Declare Found Integer
- * Issue prompt for name of system to dial
- * and read name.
- *
- Writeln " "
- Input "System to dial? " Name
- Writeln " "
- *
- * If name is null, exit this script.
- *
- If ( LENGTH( Name ) = 0 ) Then
- Exit
- Endif
- * Convert name to upper case
- Set Name = UpperCase( Name )
- * Get number of dialing directory entries
- GetParam 'DS' SEntries
- * Convert from string to integer for looping
- Set NEntries = Number( SEntries )
- * Make sure we have some entries, else quit.
- *
- If ( NEntries < 1 ) Then
- Exit
- Endif
- * Found = 0 means no entry found yet.
- Set Found = 0
- * IEntry starts out pointing to first
- * entry in dialing directory.
- Set IEntry = 1
- * Scan dialing entries and look for match.
- *
- Repeat
- * --- Get next dialing entry using
- * "DialEntry" function.
- *
- * Strip off stuff after name/number using
- * the "Substr" function and convert the
- * name/number to uppercase using the
- * "UpperCase" function.
- *
- Set DirEnt = UpperCase( Substr( DialEntry( IEntry ), 1, 40 ) )
- *
- * --- Search for the desired name using the
- * "Index" function. If the search string
- * is found in the current entry, then
- * set Found to 1 so that the search loop
- * will terminate. If the name isn't found
- * in the current entry, then increment
- * "IEntry" to point to the next dialing
- * directory entry.
- *
- If ( Index( Name , DirEnt ) > 0 ) Then
- Set Found = 1
- Else
- Set IEntry = IEntry + 1
- Endif
- *
- Until ( ( Found = 1 ) OR ( IEntry > NEntries ) )
- *
- * If entry not found, issue message and
- * exit script.
- *
- If ( Found = 0 ) THEN
- Writeln "Name not found."
- Writeln " "
- Exit
- Endif
- * If entry found, dial it. Note that
- * dialing command wants the entry number
- * as a string, so we must convert it to
- * a string for use with the dialing command.
- *
- * Note that you can do fancier processing
- * at this point, like adding prefix/postfix
- * codes, or checking for long distance
- * area codes, and so on. Just modify the
- * value of Name to match your requirements.
- Set Name = STRING( IEntry )
- *
- Dial Name
- *