Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

You will note that some Action properties are of type TStrings. TStrings is a standard Delphi type that we have exposed to the scripting engine. It is basically a string collection. Below are the properties of TStrings that you will find useful:

Method CallExample

...

Description

...

procedure Clear;

...

Action.ListOfItems.Clear;Clears the TStrings object of all the strings it contains.
function Add(const

...

text: string): Integer;var index = Action.ListOfItems.Add('Item 5');

...

Appends a string to the end of the list of string the TStrings object contains. The index of the newly added text is returned.
procedure Delete(

...

index: Integer);

...

Action.ListOfItems.Delete(5);Deletes the string located at the passed in index. If the index does not exist and error is generated.
procedure Insert(

...

index: Integer; const

...

text: string);

...

Action.ListOfItems.Insert(5, 'Item 5');Inserts the passed in text at the passed in index. If the index is outside the bounds of the list which the TStrings object holds and error is generated.
function IndexOf(const

...

text: string): Integer;

...

Action.ListOfItems.IndexOf('Item 5');Returns the index of the passed in string. If it doesn't exist in the list of string held by the TStrings object, -1 is returned.
property Strings[

...

index: Integer]: string

...

; var item5Text = Action.ListOfItems.Strings[5];Returns the text held at the passed in index. The index is zero based

...

. If the index does not exist in the current list of string help by the TStrings object an error is raised.
property Count: Integer;

...

var count = Action.ListOfItems.Count;Returns the number of string held by the TStrings object.
property Text: string; var list = Action.ListOfItems.Text;//returns the entries in the collection, each entry on a new line

...

property Names[

...

index: Integer]: string;  var item5Name = Action.ListOfItems.Names[5];// used to access the name of a string which is of the format <name>=<value>

...

property Values[

...

name: String]: string; var item5Value = Action.ListOfItems.Values[item5Name]; // used to access the value of a string which is of the format <name>=<value>

...

property ValueFromIndex[

...

index: Integer] : string;var item5Value = Action.ListOfItems.ValueFromIndex[5]; // used to access the value of a string which is of the format <name>=<value>

 

Example

...

The following code reduces each item in a List Iterator's list of items down to its leftmost three characters: