name: SimpleScannerModule
class: autohit.call.modules.SimpleScannerModule
A simple string scanner module. It's useful for verification. There is a cursor that marks the current position of the scan into the target string. The cursor starts at the first character in the string--index of zero. It can be moved forward with various commands or back the the beginning with "reset."
You must "start" a session before you can do anything. All other
methods may throw a fault error if they are called before a session
if started. It uses the java.util.regex package for pattern matching. You must
add patterns before they can be matched. They are cached for the life of this
module. It will maintain a cursor into the scan target. the cursor can me
modified or reset with various methods.
method |
"start" |
parameters: |
"target" (REQUIRED): The string that will be scanned. |
returns: |
nothing |
description: |
Starts a session |
method |
"add" |
parameters: |
"url" (REQUIRED): Name of the pattern. |
"pattern" (REQUIRED): The pattern to be added. | |
returns: |
nothing |
description: |
Add a regular expression pattern. If one of the same name already exists, it will be replaced. See the java.util.regex package for a description of the supported expressions. |
method |
"reset" |
parameters: |
none |
returns: |
nothing |
description: |
Reset the cursor to the beginning of the target. |
method |
"find" |
parameters: |
"name" (REQUIRED): Name of the pattern to find. |
returns: |
Length of the found pattern or "0" if not found. |
description: |
Find a pattern using a regular expression. The pattern must have been previously added. If found, the cursor is left at the beginning of the pattern, otherwise it is unmoved. |
method |
"seek" |
parameters: |
"string" (REQUIRED): An exact string to find. |
returns: |
"true" if found, otherwise "false". |
description: |
Find an exact string, not using regular expressions. If found, the cursor is left at the beginning of the string, otherwise it is unmoved. |
method |
"seekinsensitive" |
parameters: |
"string" (REQUIRED): An string to find. |
returns: |
"true" if found, otherwise "false". |
description: |
Find a string without regard to case, not using regular expressions. If found, the cursor is left at the beginning of the string, otherwise it is unmoved. |
method |
"substring" |
parameters: |
"start" (REQUIRED): Index of the first character in the substring. |
"string" (REQUIRED): Index of the last character in the substring plus one. | |
returns: |
The substring |
description: |
This returns a substring from the target. It will use start and end as the frame. End points to the character after the last character in the string. (This is just like with the String.substring() in java.) |
method |
"set" |
parameters: |
"spot" (REQUIRED): The index of the spot to put the cursor. |
returns: |
nothing |
description: |
This is the spot to put the cursor. The string starts from index 0. If the spot is out of bounds, you'll get an error and the cursor will stay where it is. |
method |
"get" |
parameters: |
none |
returns: |
The position of the cursor. |
description: |
This will return the current position of the cursor. |
method |
"move" |
parameters: |
"add" (REQUIRED): Move the cursor forward by this number. |
returns: |
nothing |
description: |
Move the cursor forward. If the new position is out of bounds, you'll get an error and the cursor will stay where it is. |
AUTOHIT 2003
MODULES DOCUMENTATION
Copyright Erich P Gatejen (c) 1989,1997,2003,2004
See license for details.