4.2 Application Definition Variables
The following are some of the best practice rules to follow when creating an application definition. These rules make reading the application definition easier and also help if you need to make modifications in the future.
This section contains the following information:
-
Section 4.2.1, Symbols Used
-
Section 4.2.2, Capitalization
-
Section 4.2.3, Comments
-
Section 4.2.4, Switches
-
Section 4.2.5, Variables
-
Section 4.2.6, Indent Sections
-
Section 4.2.7, Blank Line Between Sections
-
Section 4.2.8, Writing Subroutine Sections
-
Section 4.2.9, Quotation Marks
-
Section 4.2.10, Password Policy Names
-
Section 4.2.11, Regular Expressions
4.2.1 Symbols Used
Table 4-1 Description of Symbols
< >
|
Angle brackets represent an item.
For example, text, variable, or value. |
[ ]
|
Square brackets represent an optional item.
If an item is not marked with square brackets, it is a compulsory item. |
|
Indicates a line break |
4.2.2 Capitalization
Use capitalization where applicable.
Table 4-2 Capitalization
messagebox "some text" -yesno ?result
|
MessageBox "Some text" -YesNo ?Result.
|
4.2.3 Comments
Use comments throughout to explain what each section does and how it does it.
Table 4-3 Comments
Dialog Class #32770 Title"Log on"EndDialog
|
# Written By: B. Smith 07/Jun/2002# Last Modified By: C. Silvagni 13/Mar/2003# Logon Dialog BoxDialog Class #32770 Title "Log on"EndDialog
|
4.2.4 Switches
Switches are placed directly after the command, for example, Type -Raw, If -Text.
Table 4-4 Switches
Type $Username -Raw
|
Type -Raw $Username
|
4.2.5 Variables
All variable names start with a capital letter.
Table 4-5 Variables
Type $username
|
Type $Username
|
4.2.6 Indent Sections
Indent sections between pairs of commands, for example Dialog, Repeat, If.
An indent of three spaces is recommended.
Table 4-6 Indent Sections
If -Text "Some text"#Do thisElse#Do ThisEndIf
|
If -Text "Some text" #Do thisElse #Do thisEndIf
|
4.2.7 Blank Line Between Sections
Leave a blank line between sections, for example, between the Dialog Block and the rest of the application definition.
Table 4-7 Blank Line between Sections
# Log on Dialog BoxDialog Class #32770 Title "Log on"EndDialogType $Username #1001Type $Password #1002Click #1
|
# Logon Dialog BoxDialog Class #32770 Title "Log on"EndDialogType $Username #1001Type $Password #1002Click #1
|
4.2.8 Writing Subroutine Sections
Write subroutine sections at the bottom of the application definition and not partway through.
The name of the subroutine should describe its function. Do not use a numeric name. The name should follow the capitalization rule.
Wherever possible, use the Include command to create generic application definitions for frequently used elements, for example password change procedures. For common processes within the same application definition, use subroutines.
4.2.9 Quotation Marks
Always use quotation marks around segments of text in commands.
Table 4-8 Using Quotation Marks
Type TextOrIf -Text Login
|
Type "Text"OrIf -Text "Log on"
|
4.2.10 Password Policy Names
Password policy names should represent the program they are used for. Do not use numerical names.
Table 4-9 Password Policy Names
PasswordPolicy3
|
GroupwisePasswordPolicy
|
At the top of the application definition, enter and comment out information, for example, the author and the date of the last modification.
Table 4-10 Example
Dialog Class #32770 Title "Log on"EndDialog
|
# Written By: B. Smith 07/Jun/2002# Last Modified By: C. Silvagni 13/Mar/2003# Logon Dialog BoxDialog Class #32770 Title "Log on"EndDialog
|
NOTE:Always place the Title command after all other commands in the Dialog block.
4.2.11 Regular Expressions
Regular expressions are text patterns normally used for string matching. Regular expressions might contain a mix of plain text and special characters to indicate the kind of matching to be done.
For example, if you are searching for any numeric character, then the regular expression that you use for the search is, “[0-9]”.
The square [ ] brackets indicate that the character that is compared must match any one of the characters enclosed with in the brackets. The dash ( - ) between the zero (0) and nine (9) indicates that the range is between the number zero and nine.
If you need search for a special character, then you must use the backslash (\) before the special character.
The following table briefly describes the Novell supported special characters that can be used in regular expressions within the Novell SecureLogin application definition, in particular the RegSplit command detailed in the Section 5.2.60, RegSplit.
Table 4-11 Special Characters
\ (Backslash) |
The \ is an escape character indicating that the next character must be used as a regular search character and not as a special character.
For example, the regular expression “\” matches a single asterisk and the expression “\\” matches a single backslash. |
^ (Caret) |
The ^ is an anchor. If you use the ^ preceding any character, it searches the beginning character of any string.
For example, the expression “A^” matches an “A” only at the beginning of the string. |
[^ (Square bracket and Caret) |
The ^ immediately following [, is used to exclude the characters within the square brackets from matching the target string.
For example, the expression “[^0-9]” specifies that the target character must not be a numeral. |
$ (Dollar symbol) |
The $ is an anchor. The $ matches the end of the string.
For example, the expression “abc$” matches the substring “abc” only if it is at the end of the string. |
| (Vertical bar or pipe) |
The | allows the character on either side of the vertical bar (or pipe) to match the target string.
For example, the expression “a|b” matches a as well as b. |
. (Period, Full stop or Dot) |
The . matches any character. |
* (Asterisk) |
The * indicates that the character to the left of the asterisk in the expression must match at least zero or more times. |
+ (Plus symbol) |
The + indicates that the character to the left of the plus symbol in the expression must match at least once. |
? (Question mark) |
The ? indicates that the character to the left of the question mark must match at least zero or more than once. |
( ) (Parenthesis) |
The ( ) enclosing a set of characters affects the order of pattern evaluation and also serves as a tagged expression that can be used when replacing the matched substring with another expression. |
[ ] (Square brackets) |
The [ ] enclosing a set of characters indicates that any of the enclosed characters might match the target character. |
For more information on regular expression, see the Electronic Text Center or search the Microsoft MSDN library.
NOTE:These reference sites provide you more detailed and comprehensive information on regular expressions, but only the expressions listed in the previous table are supported by Novell.